Forum Discussion

LOGiT's avatar
LOGiT
Regular Visitor
6 years ago
Solved

RANKX Not working as expected

Hi,

I have a table which is sorted in desc order by a basic DIVIDE measure in the column called '% Space in Backlog' (see below)

 

You can see that many of the '% Space in Backlog' are 100% but it does start to go down after that.

The RANKX I've done is as follows:

Ranktest = RANKX(V_POWERBI_DATASET,[T1CB divided by EstTreatCost])
where the [T1CB divided by EstTreatCost] measure is the '% Space in Backlog' column in the table.
As you can see in the screenshot above, it isn't showing 1 for everything in 100% for the '% Space in Backlog' column. When you go further down, it is even more messy:
Can someone please help me to get this rank working properly?

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi LOGiT,

    You can try to use below measure if it suitable for your requirement:

    Ranktest = RANKX(ALLSELECTED(V_POWERBI_DATASET),[T1CB divided by EstTreatCost],,DESC,Dense)
    

    I create a table with some sample data to test.

    SalPct = DIVIDE(SUM('Brand Rank'[Sales1]),SUM('Brand Rank'[Sales2]))
    
    CalPct = CALCULATE([SalPct])
    
    RankTest = RANKX(ALLSELECTED('Brand Rank'),[CalPct],,DESC,Dense)

    If above not help. it will be help if you share some sample data and [T1CB divided by EstTreatCost] measure formula for test.

    Best Regards,

    Jack Chen

2 Replies

  • Hey LOGiT ,

     

    try RANKX(ALL(V_POWERBI_DATASET),CALCULATE([T1CB divided by EstTreatCost]))

     

    If this is not working would you mind to share some sample data so that we can try it out by ourselves.

     

    If this post was helpful may I ask you to mark it as solution and give it some kudos?

    Have a nice day!

    BR,
    Josef

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi LOGiT,

    You can try to use below measure if it suitable for your requirement:

    Ranktest = RANKX(ALLSELECTED(V_POWERBI_DATASET),[T1CB divided by EstTreatCost],,DESC,Dense)
    

    I create a table with some sample data to test.

    SalPct = DIVIDE(SUM('Brand Rank'[Sales1]),SUM('Brand Rank'[Sales2]))
    
    CalPct = CALCULATE([SalPct])
    
    RankTest = RANKX(ALLSELECTED('Brand Rank'),[CalPct],,DESC,Dense)

    If above not help. it will be help if you share some sample data and [T1CB divided by EstTreatCost] measure formula for test.

    Best Regards,

    Jack Chen