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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply

Find Order Ranking of the customers based on Order date and order status

Hello,

 

My orders table where I need to rank the order of our customer according to their customer id, order date and not to include the Order cancelled to the ranking.

 

Screenshot_2022-06-19-00-00-27-219_com.microsoft.office.excel.jpg

What I need to happen in power bi is a calculated column with the order ranking like this:

 

Screenshot_2022-06-19-00-05-04-169_com.microsoft.office.excel.jpg

Pleasr help! I have been trying to solve this for a coupoe of days noe.

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached file.

It is for creating a new column.

 

Untitled.png

 

Rank by customer and order date CC =
VAR _currentcustomer = Data[Customer_ID]
VAR _newtable =
    FILTER (
        Data,
        Data[Customer_ID] = _currentcustomer
            && Data[Order_status] = "Complete"
    )
VAR _rankingresult =
    RANKX ( _newtable, Data[Order_date],, ASC )
RETURN
    IF ( Data[Order_status] = "Complete", _rankingresult )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached file.

It is for creating a new column.

 

Untitled.png

 

Rank by customer and order date CC =
VAR _currentcustomer = Data[Customer_ID]
VAR _newtable =
    FILTER (
        Data,
        Data[Customer_ID] = _currentcustomer
            && Data[Order_status] = "Complete"
    )
VAR _rankingresult =
    RANKX ( _newtable, Data[Order_date],, ASC )
RETURN
    IF ( Data[Order_status] = "Complete", _rankingresult )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

@Jihwan_Kim You are indeed a super user! It worked. Thank you.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.