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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Rank

Hi,

I want to rank my table having sales value, clientid and year such that it shows me rank of clients based on there salesvalue for each year.

Kindly help me to write dax to achieve the same.

Thanking in anticipation.

3 ACCEPTED SOLUTIONS
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please try this [Rank] measure:

Rank =
RANKX (
    ALLEXCEPT ( 'Client sales', 'Client sales'[Year] ),
    CALCULATE (
        SUM ( 'Client sales'[SalesValue] ),
        ALLEXCEPT ( 'Client sales', 'Client sales'[Clientid], 'Client sales'[Year] )
    ),
    ,
    DESC,
    DENSE
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

Anonymous
Not applicable

Thanks a lot for help..It works..

View solution in original post

Hello Honey,

That's the same solution I updated 2 days ago. It's only the data I used which is different. Please mark it as an accepted solution too in case you agree, else request you to notify me as to what could have been better.

Thanks in advance!

View solution in original post

5 REPLIES 5
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please try this [Rank] measure:

Rank =
RANKX (
    ALLEXCEPT ( 'Client sales', 'Client sales'[Year] ),
    CALCULATE (
        SUM ( 'Client sales'[SalesValue] ),
        ALLEXCEPT ( 'Client sales', 'Client sales'[Clientid], 'Client sales'[Year] )
    ),
    ,
    DESC,
    DENSE
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks a lot for help..It works..

Hello Honey,

That's the same solution I updated 2 days ago. It's only the data I used which is different. Please mark it as an accepted solution too in case you agree, else request you to notify me as to what could have been better.

Thanks in advance!
Anonymous
Not applicable

Hi , 

Table with dummy data that i am using is below, need to rank them:

 Capture.PNG

test.PNGtest1.PNG

 

Hope this helps!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.