Forum Discussion
lucie_raboch
Helper II
1 year agoRANKX doesnt work as It should
Hi all, My goal is to show top 20 master by metric Sales and the rest will be grouped like 'Others'. I'm working with RANKX to be able rank values, but it is showing 11111 insted of 1,2,3,4,5. Ca...
- 1 year ago
Hi lucie_raboch based on my understanding on the data model, here is the calculated table , please test it if it works, not able to upload pbix file
TopMasterTable =VAR BaseTable =SUMMARIZE('Master_Unique','Master_Unique'[Master])VAR SalesWithValues =ADDCOLUMNS(BaseTable,"Sales",CALCULATE(SUM('FactVarMetrics'[Value]),'DimSce'[Scenario] = "Budget",'DimSce'[Metric] = "Gross",TREATAS(VALUES('Master_Unique'[Master]), 'DimProducts'[Master])))VAR WithRank =ADDCOLUMNS(SalesWithValues,"Sales Rank",RANKX(SalesWithValues,[Sales],,DESC,DENSE))RETURNADDCOLUMNS(WithRank,"MasterGroup",IF([Sales Rank] <= 20, [Master], "Others"))
lucie_raboch
Helper II
1 year agoWow, yes, It is working now! Thank you for this solution.