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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Fusilier
Helper III
Helper III

Help with RANKX in an existing measure

Hi,

I have this measure:

%SBC Count Agree = DIVIDE( SUM('Raw Data'[Agree]) , CALCULATE(SUM('Raw Data'[row count]),all('Raw Data'[Answers aggregated])))
It produces all Agree responses as a % of total answers for each question.
What I want to do is use it to create a rank of the result of the measure so if Q1 is highest at 23% and Q5 is second highest at 21% I get Q1 = 1, Q5 = 2 etc.
Is this possible. I've tried adding RANKX but can't ge it to work (not sure if it can work though)
1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @Fusilier - Yes, it is possible to use RANKX to rank the result of your %SBC Count Agree measure based.

 

create below calculation:

Rank Agree % =
RANKX(
ALL('Raw Data'[Question]), // Table over which to rank (all questions)
[%SBC Count Agree], // Expression to rank by (the percentage measure)
, // Leave empty for default
DESC, // Rank in descending order (highest percentage first)
DENSE // Use DENSE ranking to avoid gaps in ranks
)
 

you should be able to rank your questions by the percentage of "Agree" responses as you want.

Hope this helps.





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
rajendraongole1
Super User
Super User

Hi @Fusilier - Yes, it is possible to use RANKX to rank the result of your %SBC Count Agree measure based.

 

create below calculation:

Rank Agree % =
RANKX(
ALL('Raw Data'[Question]), // Table over which to rank (all questions)
[%SBC Count Agree], // Expression to rank by (the percentage measure)
, // Leave empty for default
DESC, // Rank in descending order (highest percentage first)
DENSE // Use DENSE ranking to avoid gaps in ranks
)
 

you should be able to rank your questions by the percentage of "Agree" responses as you want.

Hope this helps.





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

Proud to be a Super User!





Got it working!

Thank you very much for your help.

Thank you for your help.

I've tried the measure in a table but it's returning 1 for every line:

table.png

I'll have another look.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.