Forum Discussion
RANKX issue
- 6 years ago
Hi Anonymous ,
Please create measures like this.
Measure = CALCULATE( SUM(Sales[Sale 2014]), FILTER( ALL(Sales), Sales[Month] = MAX(Sales[Month]) && Sales[CountryRegion] = MAX(Sales[CountryRegion]) ) )Measure 2 = VAR x = RANKX( FILTER( ALLSELECTED(Sales), Sales[Month] = MAX(Sales[Month]) ), [Measure], , ASC, Dense ) VAR y = RANKX( FILTER( ALLSELECTED(Sales), Sales[CountryRegion] = MAX(Sales[CountryRegion]) ), [Measure], , ASC, Dense ) RETURN IF( HASONEFILTER(Sales[CountryRegion]), x, y )Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks Anonymous any idea how i could do the change of ranking by month piece?
Anonymous , you have use isinscope and change ranking
https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/
example
Rank1 = Rankx(all(Table[Month]),[Sales])
Rank2 = Rankx(all(Table[Date]),[Sales])
SWITCH (
TRUE,
ISINSCOPE ( Table[Month] ), [Rank1],
ISINSCOPE ( Table[Date] ), [Rank2],
[Rank3]
)
- Anonymous6 years agoNot applicable
@amitchandak so in my matrix i am trying to Rank with i have Username/Month/Region/Category then i want to rank by the total sales. But when i add my currently measure of rank Rankx(ALL(Username),[Total Sales]) it gets confused and just displays ones when i drill down from username to month then region and category. I have tried to use isinscope but can't see to get it working