Forum Discussion
DeepakSharma_01
1 year agoFrequent Visitor
RANKX Dax function behavior with different column from same table
Hi all, I have written a DAX to rank a measure, which I'll use with different columns but the result is Orpos_item_ID is working fine but with other columns from the same table it is not working....
- 1 year ago
Hi DeepakSharma_01 You could try ISINSCOPE function to evaluate current dimention and rank. See an example code:
Rank = VAR CurrentDimensionRank = SWITCH( TRUE(), ISINSCOPE(DimProduct[Color]), RANKX(ALL(DimProduct[Color]), [Revenue], ,DESC, Dense), ISINSCOPE(DimProduct[ModelName]), RANKX(ALL(DimProduct[ModelName]), [Revenue], ,DESC, Dense), ISINSCOPE(DimProduct[ProductLine]), RANKX(ALL(DimProduct[ProductLine]), [Revenue], ,DESC, Dense) ) RETURN CurrentDimensionRankThis measure will work for all 3 dimention color, ModelName, and ProductLine.
Hope this helps!!If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
DeepakSharma_01
1 year agoFrequent Visitor
Thank You so much Mr. Shafiz,
It's working fine.