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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
hassanh2
Helper I
Helper I

Rank Customers by Order Date

Hello,

 

Can someone please help with the following - I need to Rank Customer ID by SalesDate Desc.
The Fact table I have has more than 10K customers and each has multiple sales records in the same day. Same day sales shall be ranked the same rank. 

hassanh2_0-1695704203652.png

 

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @hassanh2 
You can add calculated column with DAX Formula:

RankDate =
RANKX(
    FILTER(
        'table',
        'table'[Customer] = EARLIER('table'[Customer])
    ),
    'table'[Date],
    ,
    DESC
)
The sample file is Linked here 
 

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Hi @hassanh2 
Did you download my linked file?
I checked it again now, and the results are correct...

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

3 REPLIES 3
hassanh2
Helper I
Helper I

Hi @Ritaf1983 
Thank you for your support, but unfortunately the DAX you sent didnt return the result what I was looking for. In some cases the rank started from 2, also sometimes the rank was not consistent 1,2,4,7,...etc. I tried by adding Dense to your DAX but still didn't solve the issue.

Ritaf1983
Super User
Super User

Hi @hassanh2 
You can add calculated column with DAX Formula:

RankDate =
RANKX(
    FILTER(
        'table',
        'table'[Customer] = EARLIER('table'[Customer])
    ),
    'table'[Date],
    ,
    DESC
)
The sample file is Linked here 
 

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi @hassanh2 
Did you download my linked file?
I checked it again now, and the results are correct...

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

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.