Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
I need to create a DAX formula that returns a value based on the dates. I am working with three different dates.
Created On Date = When the delivery was created
Planned Goods Issue Date = When the warehouse should ship the delivery
Shipped Date = When warehouse physically shipped the delivery
We make the assumption that the material was on backorder if the delivery created the same day it was to ship or the day after.
I need a formula to return a value of:
Back Order - if the delivery was created on the same day it was to ship and did not ship on the Planned Goods Issue date. (delivery 87980771 in screen shot)
Back Order - if the delivery was created the a day before is was to ship and did not ship on the Planned Goods Issue date. (delivery 87980772 in screen shot)
Back Order - if the delivery was created after the Planned Goods Issue date. (delivery 87980775 in screen shot)
Late - if the delivery was shipped two or more days after the Planned Goods Issue date. (delivery 87980776 in screen shot)
On-Time - if the delivery was created on the same day as the Planned Goods Issue date and was shipped the same day. (delivery 87980773 in screen shot)
On-Time - if the delivery was shipped on or before the Planned Goods Issue date. (deliveries 87980777,87980773,87980778 in screen shot)
Thank you for your help
Solved! Go to Solution.
Hi, @GMadd
Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.
Measure:
Status1 =
VAR _getCreateDate =
SELECTEDVALUE ( 'Table'[Created On] )
VAR _getPlanedDate =
SELECTEDVALUE ( 'Table'[Planned Goods Issue] )
VAR _getShippedDate =
SELECTEDVALUE ( 'Table'[Shipped Date] )
RETURN
SWITCH (
TRUE (),
_getShippedDate - 2 >= _getPlanedDate
&& _getShippedDate - 2 >= _getCreateDate, "Late",
_getShippedDate >= _getPlanedDate + 1
|| _getShippedDate = _getCreateDate + 1, "Backorder",
_getShippedDate = _getCreateDate, "On-time",
"CheckData"
)
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi, @GMadd
Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.
Measure:
Status1 =
VAR _getCreateDate =
SELECTEDVALUE ( 'Table'[Created On] )
VAR _getPlanedDate =
SELECTEDVALUE ( 'Table'[Planned Goods Issue] )
VAR _getShippedDate =
SELECTEDVALUE ( 'Table'[Shipped Date] )
RETURN
SWITCH (
TRUE (),
_getShippedDate - 2 >= _getPlanedDate
&& _getShippedDate - 2 >= _getCreateDate, "Late",
_getShippedDate >= _getPlanedDate + 1
|| _getShippedDate = _getCreateDate + 1, "Backorder",
_getShippedDate = _getCreateDate, "On-time",
"CheckData"
)
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 14 | |
| 11 | |
| 6 | |
| 5 |