cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CarlsBerg999
Helper IV
Helper IV

Ranking a category (calculated column)

Hi, i have a pretty simple ranking issue im unable to resolve.

 

In an example table i have 4 rows and 2 columns. 

 

A - 5

A - 7

B - 13

B - 4

 

I want rank these categories (A and B). How do i rank them from 1 to 2 rather than from 1 to 4? The result should be B = 1 and A = 2. 

 

Thanks!

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@CarlsBerg999 

is this what you want?

Column = RANKX(ALL('Table (2)'),CALCULATE(SUM('Table (2)'[VALUE]),ALLEXCEPT('Table (2)','Table (2)'[ID])),,DESC,Dense)

1.PNG





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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

The ranking should typically done in a measure.   Why do you want it as a column?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

@CarlsBerg999 

is this what you want?

Column = RANKX(ALL('Table (2)'),CALCULATE(SUM('Table (2)'[VALUE]),ALLEXCEPT('Table (2)','Table (2)'[ID])),,DESC,Dense)

1.PNG





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

Proud to be a Super User!




View solution in original post

Jihwan_Kim
Super User
Super User

Picture1.png

 

Ranking measure : =
RANKX ( ALL ( Categories ), CALCULATE ( SUM ( Data[value] ) ),, DESC )

 

 

Link to the sample pbix file 

 

 


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Best regards, JiHwan Kim

Linkedin: https://www.linkedin.com/in/jihwankim1975/

Twitter: https://twitter.com/Jihwan_JHKIM

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!