Vineesh V
Vineesh V

Reputation: 33

Rank for a specific company for Different product groups Power Bi DAX

I want to show the sales rank of a specific company among a list of companies for every product group. enter image description here

From the below table I want to see only the rank of Company B in all prod groups. The output should look like

enter image description here

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

Answers (1)

Ashok Anumula
Ashok Anumula

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)

enter image description here

Upvotes: 1

Related Questions