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
Evelien
Advocate I
Advocate I

Calculated column with rank based on value, plus dependency on 2 categories

Hi,

I am looking for the DAX formula to create a calculated column to show the rank by value, per month and per product.

The rank column should look like this:

 

MonthProductCompanyValueRank
1/01/2017AHello3001
1/01/2017ABla2502
1/01/2017AHey1003
1/02/2017BHello203
1/02/2017BBla402
1/02/2017BHey501
1/01/2017BBla2451

 

Many thanks for your help!

 

Kind regards,

Evelien

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@Evelien

 

Hi, try with this:

 

Rank-CC =
RANKX (
    ALL ( Table1[Company] ),
    CALCULATE (
        SUM ( Table1[Value] ),
        ALLEXCEPT ( Table1, Table1[Month], Table1[Product], Table1[Company] )
    )
)

Regards

 

Victor

Lima - Peru




Lima - Peru

View solution in original post

3 REPLIES 3
Vvelarde
Community Champion
Community Champion

@Evelien

 

Hi, try with this:

 

Rank-CC =
RANKX (
    ALL ( Table1[Company] ),
    CALCULATE (
        SUM ( Table1[Value] ),
        ALLEXCEPT ( Table1, Table1[Month], Table1[Product], Table1[Company] )
    )
)

Regards

 

Victor

Lima - Peru




Lima - Peru
Zubair_Muhammad
Community Champion
Community Champion

Hi @Evelien

 

Try this calculated column

 

RANK_ =
RANKX (
    FILTER (
        ALL ( TableName ),
        MONTH ( TableName[Month] ) = MONTH ( EARLIER ( TableName[Month] ) )
            && TableName[Product] = EARLIER ( TableName[Product] )
    ),
    TableName[Value],
    ,
    DESC,
    DENSE
)

Regards
Zubair

Please try my custom visuals

Hi @Zubair_Muhammad,

 

Thanks for your help, but I do not get the correct rank when using the formula you suggested :-S

 

 Capture.PNG

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.