cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nbrandborg
Helper I
Helper I

Rank per product number?

Hi all


I have a dataset with three columns with data (a-c) and one measure (d) a percentage of total sales per product number.


However if I want to pull up the rank for the individual Countries per Product Number in a seperate column, is there an easy way to do this?
If similar procentage value then it should have same ranking.


I reckon it a RANKX based on the condition of the product number and sales per country.

 

The expected outcome should be like this:

Product numberCountrySalesPercentageRank
111Denmark10016,67%3
111Norway15026,66%2
111Sweden25040,00%1
111Finland10016,67%3
222Finland20025,00%2
222Iceland20025,00%2
222Sweden40050,00%1
333Denmark10020,00%2
333Sweden40080,00%1
1 ACCEPTED SOLUTION
CNENFRNL
Super User
Super User

Screenshot 2021-09-23 042837.png

Screenshot 2021-09-23 043326.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

5 REPLIES 5
CNENFRNL
Super User
Super User

Screenshot 2021-09-23 042837.png

Screenshot 2021-09-23 043326.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is beyond their comprehension!

DAX is simple, but NOT EASY!

Thank you CNENFRNL!
It did the job as expected. 

Best regards!

richbenmintz
Super User
Super User

Hi @nbrandborg ,

 

you can create the following measures:

Pct = DIVIDE(sum('Table'[Sales]),  CALCULATE(sum('Table'[Sales]), ALLEXCEPT('Table','Table'[Product number])))

Rank = RANKX(ALLEXCEPT('Table','Table'[Product number]), [Pct])

 

richbenmintz_0-1632343417048.png

 



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


Hi richbenmintz,

Unfortunately it didn't work. It came with a "circular dependency" error.

Best regards!

Hi @nbrandborg ,

 

I am guessing you tried to create calc columns and not measures 



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors