|
此文章由 平平淡淡 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 平平淡淡 所有!转贴必须注明作者、出处和本声明,并保持内容完整
flat26a 发表于 2014-9-19 14:45 
谢谢楼主!我发给你Gmail邮箱了,请查收
I have sent the completed file back to your email. You can also download the sample workbook from below link.
https://onedrive.live.com/?cid=7 ... 5E31C189063EC%21124
I know you probably do not know Power Pivot much. The key to address your issue is having a disconnected table ( do not set up relationship with your main table), in your case it's the TOP X table with one column. You can google Disconnected Table and find lots of interesting post on this top for Power Pivot.
I start off by building the base measure Spend = SUM(DATA[AMOUNT])
Number of Supplier = DISTINCTCOUNT(DATA[VENDOR_NAME])
then I rank your category based on Spend CategoryRank = RANKX(ALL(DATA[Category]),DATA[Spend])
Finally the driver for Dynamic TOP N count is hidden measure(hide it as your users don't need to see it)
IF(HASONEVALUE('TOP'[TOP X]),IF(DATA[CategoryRank]<=VALUES('TOP'[TOP X]),1,0))
This formula checks if only 1 value selected in the TOP N slicer, if yes, all category with rank <= selected slicer value will get 1, else will get 0. if your user selected more than 1 value in slicer, then nothing will be shown as it doesn't make any sense to see top X and Y at the same time.
The Last thing is turn on the value filter to show 1 for the hidden measure
All the formula are exclusive to Power Pivot which is DAX formula and they are not part of normal Excel functions.
There you have it. Dynamic TOP N (what ever you like to call it) |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
评分
-
查看全部评分
|