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

We'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

Reply
GMadd
Helper I
Helper I

Conditional Result based on Dates

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)

 

GMadd_0-1708008130646.png

 

Thank you for your help

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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.

 

vyaningymsft_0-1708066654465.png

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

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

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.

 

vyaningymsft_0-1708066654465.png

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

 

 

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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