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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
hmeltonPSL
Helper II
Helper II

Comparing Multiple Date Fields

I have 4 date fields.  Date Ordered, Date Shipped, Date Received, Date Created.  I want to compare the dates in each field with each other to find which is the newest date then assign a field with value of the field name to show what stage the order is in.  Does anyone have any ideas or a different approach?  Thanks

 

DAte Created  7/1/2023

Date Ordered 7/3/2023

Date Shipped

Date Received

Stage = Ordered

 

DAte Created  7/1/2023

Date Ordered 7/3/2023

Date Shipped 7/13/2023

Date Received

 

Stage = Shipped

2 ACCEPTED SOLUTIONS
vicky_
Super User
Super User

vicky__0-1690497733352.png

Rather than comparing dates, I just thought to look for which statuses have a value to determine the status. I'm assuming here, that the order of statuses is Create > Order > Shipped > Received. 

 

Here's the measure I used:

Status = 
var _ordered = SELECTEDVALUE('Table'[Ordered])
var _shipped = SELECTEDVALUE('Table'[Shipped])
var _received = SELECTEDVALUE('Table'[Received])
return SWITCH(TRUE(), 
    ISBLANK(_received) && ISBLANK(_shipped) && ISBLANK(_ordered), "Created",
    ISBLANK(_received) && ISBLANK(_shipped), "Ordered",
    ISBLANK(_received), "Shipped", 
    "Received"
)

You'll probably need to make some tweaks for it to work for your specific data though.

View solution in original post

Ahmedx
Super User
Super User

Is this what you are looking for?

Screenshot_1.png

View solution in original post

4 REPLIES 4
Ahmedx
Super User
Super User

Is this what you are looking for?

Screenshot_1.png

Yes it is...thank you

vicky_
Super User
Super User

vicky__0-1690497733352.png

Rather than comparing dates, I just thought to look for which statuses have a value to determine the status. I'm assuming here, that the order of statuses is Create > Order > Shipped > Received. 

 

Here's the measure I used:

Status = 
var _ordered = SELECTEDVALUE('Table'[Ordered])
var _shipped = SELECTEDVALUE('Table'[Shipped])
var _received = SELECTEDVALUE('Table'[Received])
return SWITCH(TRUE(), 
    ISBLANK(_received) && ISBLANK(_shipped) && ISBLANK(_ordered), "Created",
    ISBLANK(_received) && ISBLANK(_shipped), "Ordered",
    ISBLANK(_received), "Shipped", 
    "Received"
)

You'll probably need to make some tweaks for it to work for your specific data though.

This also worked.  Thanks for the help!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.