Reputation: 33
I want to show the sales rank of a specific company among a list of companies for every product group.
From the below table I want to see only the rank of Company B in all prod groups. The output should look like
Please note that I am selecting the required company (B in this case) from the inbuilt filters pane in power bi. I tried writing a dax, which shows 1 as the rank for every prog groups, which is wrong
Rank Group =
var sel_company = selectedvalue([company])
var sel_category = selectedvalue([Prod Group])
return rankx(filter(all('Table'),[Prod Group]=sel_category),calculate(sum([sales])),,DESC, dense)
Thanks
Upvotes: 0
Views: 505
Reputation: 1515
Write a measure for Sum of sales
Measure = SUM(Data[Sales])
Write a measure for Rank
Rank = RANKX(ALLEXCEPT(Data, Data[Prod Group]), [Measure],,DESC,Dense)
Upvotes: 1