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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jochungJE
Frequent Visitor

Ranking Column by Supplier Grouping

Hi,

I am new to Power BI and I am hoping I can get some help with ranking issue. Thanks in advance for all your help with this question.

 

I have a table that contain supplier score by category and measurement. I need to rank the supplier by the total score for the period. The score is break down by Category and Measurement.

 

I tried the with RANKX as follow:

Ranking =
RANKX(
    ALLSELECTED('Table'[Supplier ]),
    CALCULATE(SUM('Table'[GroupScore])),
    ,
    DESC,Dense
    )
 
When I look at the table visual with just the supplier and the total score, it gives me the correct rankin by the supplier as shown.   

 

rank by Supplier.PNG

 

 

 

 

 

 

 

 

 

If I bring in the Category and the Measures into the table, my ranking is now no longer by supplier, but by Measurement as shown below. How do I apply the filter so no mater how I slide the data table, it will give me the correct ranking by supplier as shown above.

rank by Supplier2.PNG

1 ACCEPTED SOLUTION

Hi @jochungJE ,

For your requirement, please refer to the formulas below.

Measure =
COUNTROWS (
    FILTER (
        ALL ( new ),
        ISONORAFTER (
                new[sum of score], SELECTEDVALUE ( new[sum of score] ), DESC,
                new[Supplier], SELECTEDVALUE ( new[Supplier] ), DESC
        )
    )
)

Measure 2 = RANKX(ALL(new),[Measure],,DESC,Dense)

Here is the output.

Untitled.png

More details, please refer to my attachment.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @jochungJE ,

Please try this measure below.

Ranking =
RANKX (
    ALLSELECTED ( 'Table'[Supplier], 'Table'[Category], 'Table'[Measurement] ),
    CALCULATE ( SUM ( 'Table'[Score] ) ),
    ,
    DESC,
    DENSE
)

Here is my test output.

Capture.PNG

If you still need help, please share your desired output.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi Cherry,

 

See below for the desired output, I am not able to replicate this in Power BI.

The raking is for the total score of the Supplier for the Period and Group, disregard the category and measurement.

 

Thanks in advance.

ranking output.jpg

Hi @jochungJE ,

For your requirement, please refer to the formulas below.

Measure =
COUNTROWS (
    FILTER (
        ALL ( new ),
        ISONORAFTER (
                new[sum of score], SELECTEDVALUE ( new[sum of score] ), DESC,
                new[Supplier], SELECTEDVALUE ( new[Supplier] ), DESC
        )
    )
)

Measure 2 = RANKX(ALL(new),[Measure],,DESC,Dense)

Here is the output.

Untitled.png

More details, please refer to my attachment.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you @v-piga-msft ,

I need to modify both the Measure and Measure2 to include Period Key in the 'filter grouping'. Once I apply the new condition, the ranking is exactly what I needed.

 

ranking.PNG

 

Thank you so much for your support.  

 

Measure =
COUNTROWS (
FILTER (
        ALL ( new ),
ISONORAFTER (
                new[sum of score], SELECTEDVALUE ( new[sum of score] ), DESC,
                new[Supplier], SELECTEDVALUE ( new[Supplier] ), DESC,
                new[Period Key], SELECTEDVALUE(new[Period Key]),DESC
        )
    )
)
 
Measure 2 = RANKX(
    ALLEXCEPT(new,new[Period Key]),
    [Measure],
    ,
    DESC,
    Dense
    )
 
 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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