Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
nagavineela
Helper I
Helper I

How to rank ascending vs descending based on a field value in power bi desktop?

I am new to Power BI desktop and I got the requirement to rank different toys based on their category. In my requirement, if the toy belongs to category A, then I need to rank them in ascending order. If the toy does not fall in category A, I need to rank them in descending order.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@nagavineela , Try a measure like

 

rankx(filter(allselected(Table[Category], Table[Item]), Table[Category]= "Category A"),[measure],,asc) +
rankx(filter(allselected(Table[Category], Table[Item]), Table[Category]= max(Table[Category]) && Table[Category]<> "Category A"),[measure],,asc)

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@nagavineela , Try a measure like

 

rankx(filter(allselected(Table[Category], Table[Item]), Table[Category]= "Category A"),[measure],,asc) +
rankx(filter(allselected(Table[Category], Table[Item]), Table[Category]= max(Table[Category]) && Table[Category]<> "Category A"),[measure],,asc)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.