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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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