Forum Discussion

Fusilier's avatar
Fusilier
Helper III
1 year ago
Solved

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)
  • 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.

3 Replies

  • 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.

    • Fusilier's avatar
      Fusilier
      Helper III

      Thank you for your help.

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

      I'll have another look.

    • Fusilier's avatar
      Fusilier
      Helper III

      Got it working!

      Thank you very much for your help.