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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Help with RANKX - Returning 1 for All Values

I am having trouble with RANKX- I am getting a 1 for each ranking.  I am trying to rank donations by Household ID.

 

I have a measure to sum up the donations for the period:

Donation for Pd = calculate( SUM(Donation_Distributions[Amount]),
ALLSELECTED ('Dates'[Date] )
)
 
I then try to use this measure to rank by Household ID using this formula:
Household Rank = RANKX (ALLSELECTED(Donation_Distributions[Household ID]), [Donation for Pd] )
 
I am getting 1 for each rank in my visual.  Is there something I am missing in one of my formulas that is causing this?
 
Thank you!
6 REPLIES 6
Cmcmahan
Resident Rockstar
Resident Rockstar

Sure. So to break down what's happening, we need to understand how RANKX works.  

 

You're skipping the <value> parameter, so the value of the expression at the current row is used instead.  So for every [Household ID], it's evaluating your [Donation for Pd] measure.

 

It may be helpful to put all your [Household ID]s in a table visual with your [Donation for Pd] measure to make sure that every household isn't calculating the same amount for [Donation for Pd], which could cause all their ranks to be the same.  In which case, you need to fix your measure.

 

The next option is to explicitly add [Donation for Pd] as the <value> parameter for your RANKX, so that RANKX knows what value should be ranked against all the other measure results.

Anonymous
Not applicable

Ok, so I set this up in a visual.  When I add the fields Donation for Pd and Household ID it works perfectly.  I have another table that contains Household Name in a separate linked table.

 

When I add in the Household Name field in the visual, this is what breaks my ranking and shows all as #1.  Do I need to somehow include this Household Name field in my formula?

Instead of using ALLSELECTED(Donation_Distributions[Household ID]), just use ALLSELECTED(Donation_Distributions).  This returns all the columns of the Donation_Distributions table, instead of just the column of ID numbers.

 

Try:

Household Rank2 = RANKX (ALLSELECTED(Donation_Distributions), [Donation for Pd] )
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

It's only a gues, becose dont realy know the scenerio, but try removing ALLSELECTED ('Dates'[Date] ) from Donation for Pd.

 

Donation for Pd = SUM(Donation_Distributions[Amount])

Hope this helps!

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Anonymous
Not applicable

No, unfortunately this does not help.  I tried this and still am receiving the Ranking of 1 for Household ID.

Hi @Anonymous 

Can you create a data sample?

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.