Forum Discussion
hmeltonPSL
3 years agoHelper 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 va...
- 3 years ago
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.
- 3 years ago
Is this what you are looking for?
vicky_
3 years agoSuper User
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.
hmeltonPSL
3 years agoHelper II
This also worked. Thanks for the help!