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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
MichaelaMul
Helper III
Helper III

Fix Rank Measure

Hi everyone,

 

I made the measure below and it was working fine, but then I added the Segment to the table, so it is ranking it by segment rather than the entire product list that is filtered in the table. How do I adjust the measure to have it rank all the products?

 

Measure 1:
Total Dollar per $MM = SUM(TEST[Dollar per $MM per item])

Measure 2:
$ per $MM Rank = 
IF (
    NOT ( ISBLANK ( 'TEST'[Total Dollar per $MM] ) ),
    RANKX (
        FILTER ( ALLSELECTED( 'TEST'[Product] ), NOT ( ISBLANK ( [Total Dollar per $MM] ) ) ),
        [Total Dollar per $MM]
    )
)

 

Below is the table I made filtered by Geography, Time, Segment. Highlighted is what I want the Ranking to be

MichaelaMul_0-1712953853256.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@ThxAlot  @Ashish_Mathur ,thanks for your concern about this case.

 

Hi @MichaelaMul  , I used the data you provided and wrote the following DAX:

Rank = 
    IF(
    NOT ( ISBLANK ( 'TEST'[Total Dollar per $MM] ) ),
    RANKX (
        FILTER (
            ALLSELECTED('TEST'),
            NOT ( ISBLANK ( [Total Dollar per $MM] ) )
        ),
        [Total Dollar per $MM],
        ,
        DESC,
        Dense
    )
)

 

This is the result you want:

vjialongymsft_0-1713162636544.png

 

 

 

Best Regards,

Jayleny

 

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
Anonymous
Not applicable

@ThxAlot  @Ashish_Mathur ,thanks for your concern about this case.

 

Hi @MichaelaMul  , I used the data you provided and wrote the following DAX:

Rank = 
    IF(
    NOT ( ISBLANK ( 'TEST'[Total Dollar per $MM] ) ),
    RANKX (
        FILTER (
            ALLSELECTED('TEST'),
            NOT ( ISBLANK ( [Total Dollar per $MM] ) )
        ),
        [Total Dollar per $MM],
        ,
        DESC,
        Dense
    )
)

 

This is the result you want:

vjialongymsft_0-1713162636544.png

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ThxAlot
Super User
Super User

=
RANKX(
    CALCULATETABLE( VALUES( SALES[Product] ), ALLSELECTED( SALES[Product] ) ),
    [Total Dollar per $MM]
)


Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



MichaelaMul
Helper III
Helper III

here's the sample data:

GeographyTimeProduct SegmentPrice Per UnitsDollar SalesDollar per $MM per item
NorthL4 WeeksAlmond Aspetic Brand AAlmond Aseptic2.20$11,502,9471218
NorthL4 WeeksAlmond Aspetic Brand BAlmond Aseptic3.00$861,8231161
SouthL4 WeeksAlmond Aspetic Brand AAlmond Aseptic2.23$571,3841147
SouthL13 WeeksAlmond Aspetic Brand BAlmond Aseptic2.29$6,023,6221132
NorthL4 WeeksAlmond Brand AAlmond2.26$1,223,1311125
SouthL4 WeeksOat Brand COat Milk2.26$12,796,0391123
NorthL4 WeeksAlmond Aspetic Brand CAlmond Aseptic2.97$113,3411109
SouthL4 WeeksAlmond Aspetic Brand BAlmond Aseptic3.00$766,2441004
SouthL4 WeeksAlmond Aspetic Brand CAlmond Aseptic2.97$6,036,529987
SouthL13 WeeksOat Brand BOat Milk3.02$509,749977
SouthL4 WeeksAlmond Aspetic Brand DAlmond Aseptic2.97$77,351951
NorthL4 WeeksAlmond Brand BAlmond2.23$1,359,322934
NorthL4 WeeksAlmond Brand CAlmond2.23$1,236,040883
NorthL13 WeeksAlmond Brand DAlmond2.32$104,812874
NorthL4 WeeksAlmond Brand DAlmond2.16$196,572853
SouthL4 WeeksAlmond Brand AAlmond2.32$637,544849
NorthL4 WeeksOat Brand AOat Milk2.26$1,223,131836
NorthL4 WeeksOat Brand BOat Milk2.23$1,359,322769
SouthL13 WeeksOat Brand COat Milk2.32$703,315747
NorthL4 WeeksOat Brand COat Milk2.23$956,009702
NorthL13 WeeksOat Brand AOat Milk2.22$766,244698
SouthL13 WeeksAlmond Brand DAlmond3.02$454,576698
NorthL4 WeeksAlmond Aspetic Brand DAlmond Aseptic2.97$719,377685
NorthL13 WeeksAlmond Brand AAlmond2.96$835,451663
NorthL13 WeeksAlmond Brand BAlmond2.97$694,490660
NorthL13 WeeksAlmond Aspetic Brand AAlmond Aseptic3.00$106,072658
SouthL13 WeeksAlmond Brand CAlmond2.32$637,544656
NorthL13 WeeksAlmond Brand CAlmond2.32$9,155,226650
SouthL4 WeeksAlmond Brand BAlmond2.32$694,490628
SouthL4 WeeksAlmond Brand CAlmond2.97$104,812627
SouthL13 WeeksOat Brand AOat Milk3.02$9,157,542581
SouthL4 WeeksAlmond Brand DAlmond2.38$703,315574
SouthL4 WeeksOat Brand AOat Milk2.32$12,930,530566
NorthL13 WeeksOat Brand BOat Milk2.26$15,526,543565
NorthL13 WeeksAlmond Aspetic Brand BAlmond Aseptic2.97$719,377558
SouthL4 WeeksOat Brand BOat Milk2.22$626,815552
NorthL13 WeeksAlmond Aspetic Brand CAlmond Aseptic2.97$11,504,960547
NorthL13 WeeksAlmond Aspetic Brand DAlmond Aseptic3.02$835,451479
SouthL13 WeeksAlmond Aspetic Brand DAlmond Aseptic3.02$484,678477
SouthL13 WeeksAlmond Brand BAlmond2.32$553,950454
SouthL13 WeeksAlmond Aspetic Brand AAlmond Aseptic2.96$15,528,982422
SouthL13 WeeksAlmond Aspetic Brand CAlmond Aseptic2.26$2,379,752388
SouthL13 WeeksAlmond Brand AAlmond3.02$106,072357
NorthL13 WeeksOat Brand COat Milk2.23$113,341236

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.