<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Conditional Result based on Dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Result-based-on-Dates/m-p/3703265#M144040</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="663206" data-lia-user-login="GMadd" class="lia-mention lia-mention-user"&gt;GMadd&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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 &amp;gt;= _getPlanedDate

            &amp;amp;&amp;amp; _getShippedDate - 2 &amp;gt;= _getCreateDate, "Late",

        _getShippedDate &amp;gt;= _getPlanedDate + 1

            || _getShippedDate = _getCreateDate + 1, "Backorder",

        _getShippedDate = _getCreateDate, "On-time",

        "CheckData"

    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;to&lt;/STRONG&gt; help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to get your questions answered quickly&lt;/A&gt;&amp;nbsp;--&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;&amp;nbsp;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Feb 2024 06:58:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-02-16T06:58:50Z</dc:date>
    <item>
      <title>Conditional Result based on Dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Result-based-on-Dates/m-p/3701578#M143964</link>
      <description>&lt;P&gt;I need to create a DAX formula that returns a value based on the dates. I am working with three different dates.&lt;/P&gt;&lt;P&gt;Created On Date = When the delivery was created&lt;/P&gt;&lt;P&gt;Planned Goods Issue Date = When the warehouse should ship the delivery&lt;/P&gt;&lt;P&gt;Shipped Date = When warehouse physically shipped the delivery&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a formula to return a value of:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Back Order&lt;/STRONG&gt; - if the&amp;nbsp;delivery was created on&amp;nbsp; the same day it was to ship and did not ship on the Planned Goods Issue date. (delivery 87980771 in screen shot)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Back Order&lt;/STRONG&gt; - 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)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Back Order&lt;/STRONG&gt; - if the delivery was created after the Planned Goods Issue date. (delivery 87980775 in screen shot)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Late&lt;/STRONG&gt; - if the delivery was shipped two or more days after the Planned Goods Issue date. (delivery 87980776 in screen shot)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;On-Time&lt;/STRONG&gt; - 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)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;On-Time&lt;/STRONG&gt; - if the delivery was shipped on or before the Planned Goods Issue date. (deliveries 87980777,87980773,87980778 in screen shot)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 14:44:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Result-based-on-Dates/m-p/3701578#M143964</guid>
      <dc:creator>GMadd</dc:creator>
      <dc:date>2024-02-15T14:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Result based on Dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Result-based-on-Dates/m-p/3703265#M144040</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="663206" data-lia-user-login="GMadd" class="lia-mention lia-mention-user"&gt;GMadd&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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 &amp;gt;= _getPlanedDate

            &amp;amp;&amp;amp; _getShippedDate - 2 &amp;gt;= _getCreateDate, "Late",

        _getShippedDate &amp;gt;= _getPlanedDate + 1

            || _getShippedDate = _getCreateDate + 1, "Backorder",

        _getShippedDate = _getCreateDate, "On-time",

        "CheckData"

    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;to&lt;/STRONG&gt; help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to get your questions answered quickly&lt;/A&gt;&amp;nbsp;--&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;&amp;nbsp;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 06:58:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Result-based-on-Dates/m-p/3703265#M144040</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-16T06:58:50Z</dc:date>
    </item>
  </channel>
</rss>

