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
byoung
Frequent Visitor

Rankx Within Subcategory Not Working

In the attached, I'm trying to rank each "Account Desc" within each account type, but the rankx formula isn't working as expected. I would exted to see, within the assets account (misspelled in the capture), a ranking from 1-9 based on the Total Amount.

 

Please help! 

 

Capture.PNG

2 ACCEPTED SOLUTIONS
byoung
Frequent Visitor

Feeling pretty dumb right about now....I was placing the formula in a calculated column instead of a measure 🙄. Works now.

View solution in original post

Hi @byoung ,

 

If you want to use measure,please refer to

 

measure = RANKX(ALL(Transactions[Account Desc]),CALCULATE(SUM(Transactions[Amount])),,DESC,Dense)

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

7 REPLIES 7
byoung
Frequent Visitor

Thank you all for the advice. The issue persists, but I did notice that the rankings seem to be thrown off by negative numbers during the debugging process outlined in the articles shared by @amitchandak . Please reference the concatenatex column, which shows all of the values being evaluated.

 

Any idea why this may be happening? Every account has positive/negative numbers that need to be summed together and then ranked. Capture.PNG

byoung
Frequent Visitor

Feeling pretty dumb right about now....I was placing the formula in a calculated column instead of a measure 🙄. Works now.

Hi @byoung ,

 

If you want to use measure,please refer to

 

measure = RANKX(ALL(Transactions[Account Desc]),CALCULATE(SUM(Transactions[Amount])),,DESC,Dense)

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Ashish_Mathur
Super User
Super User

Hi,

Replace SUM(Transactions[Amount]) with [Total amount].  I am assuming Total amount is a measure.


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

Hi Ashish,

 

Yes, Total Amount is a measure, the formula is sum(Transactions[Amount]).

 

I've implemented the suggested solution, but it appears the data may not be aggregating/grouping properly. The field Account Type is from a joined table, I'm not sure if that makes a difference or not, there is a 1 to many relationship.

 

Please see attached, thank you.

 

Capture.PNGCapture2.PNG

Vera_33
Resident Rockstar
Resident Rockstar

Hi @byoung 

 

Do you want to rank the account in each Type respectively? Can you try this one? If not working, remove the column [Account Number], have a try, let me know how it goes.

 

RANKX(ALLSELECTED(Transactions[Account Desc),[Total Amount],,DESC,Dense)

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.