Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi, I am trying to get the following rank, but somehow my dax doesn't work.
Company | Category | Sales | Rank |
A | A | 1000 | 1 |
A | B | 500 | 3 |
B | A | 999 | 2 |
B | B | 450 | 4 |
it should rank category among category A &B.
I have tried:
rankx(all([company], [category]),
sum([sales]))
and variations with calculated columns.
Please help, thanks
Solved! Go to Solution.
@natksi , A new measure
rankx(all(Table[company], Table[category]),calculate( sum([sales])),,desc, dense)
or
a new column
Rankx(Table, [Sales],,desc, dense)
hi @amitchandak, thanks for your previous reply!
How do you deal with rankx if [category] field is filtered in the visual? Would not need to rank all categories as in
rankx(all(Table[company], Table[category]),calculate( sum([sales])),,desc, dense), just the ones filtered for in the visual
Somehow the solution suggested doesn't work.
I think it is because [ Category] is filtered in my visual. So here, we want to rank companies in only 2 categories from the table. How do we achieve that in DAX?
@natksi , A new measure
rankx(all(Table[company], Table[category]),calculate( sum([sales])),,desc, dense)
or
a new column
Rankx(Table, [Sales],,desc, dense)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |