Forum Discussion
How do I rank a filtered table?
- Anonymous2 years ago
I seem to have found a simple solution in my case. What a relief.
The TOPN filter would normally take my [Ad Metric] measure to determine what values to sort by. In this case I only wanted the values for new ads, so I made a new measure that calculates that like so:
New Ads (Ad Metric) = CALCULATE([Ad metric], FILTER('Ads Shown', [New ads selection logic]))And put it in the graph like so:
It's a miracle that the filter argument 'FILTER('Ads Shown', [New ads selection logic])' actually worked. Like, it's logical that it should work, since [New ads selection logic] is just a boolian, so it sort of creates a mask to filter the table by. Maybe my mistake before was writing '[New ads selection logic] = 1'?
But Power BI has this amazing way of not working for very simple obvious things, or making very simple obvious things extraordinarilly difficult. So I'm shocked that it worked.
Anonymous , You can create a TOPN measure based on TOPN function
M1= calculate([Your measure], keepfilters(topn(10, allselected(Table[Attribute]), [Your measure], desc) )
TOPN: https://youtu.be/QIVEFp-QiOk
TOPN with Numeric Parameter -https://youtu.be/cN8AO3_vmlY?t=26448
You can also use window function
Dynamic TOPN using TOPN/Window and Numeric parameter: https://youtu.be/vm2mdEioQPQ
Hey thanks for this! I'm not entirely sure how to plug the code you wrote into my situation? Which measures go where? How do I ensure it's only showing ads that are in the New Ads list?