<?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: Comparing two dates with a tolerance of +- 1 day in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2189003#M51135</link>
    <description>&lt;P&gt;HI&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure =&amp;nbsp;&lt;BR /&gt;Var _Dif =&amp;nbsp;Table1[Primised_Receipt_Date] - Table1[Posting_date]return&lt;BR /&gt;If(_Dif&amp;lt;=1,&lt;SPAN&gt;"On Time","Late")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;helps&lt;/SPAN&gt;&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;accepting&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;it as the solution&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 14 Nov 2021 21:43:00 GMT</pubDate>
    <dc:creator>VahidDM</dc:creator>
    <dc:date>2021-11-14T21:43:00Z</dc:date>
    <item>
      <title>Comparing two dates with a tolerance of +- 1 day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2188955#M51125</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I want to create a calculated column that counts the days between two date columns in the same table with a tolerance of +- 1 day. I am working on a performance dashboard and I want to visualize on time deliveries from a specifik vendor. If the delivery date is greater than the posting date (with a tolerance of +-1&amp;nbsp; day), the output is "Late", if the delivery date is equal or smaller than the posting date (with a tolerance of +- 1 day, the output is "On Time".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips on how to achive this?&lt;BR /&gt;&lt;BR /&gt;Best&lt;/P&gt;</description>
      <pubDate>Sun, 14 Nov 2021 18:54:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2188955#M51125</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-14T18:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates with a tolerance of +- 1 day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2188961#M51127</link>
      <description>&lt;P&gt;Is this what you're trying to write?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Punctuality =
IF ( Table1[DeliveryDate] &amp;gt; Table1[PostingDate] + 1, "Late", "On Time" )&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 14 Nov 2021 19:09:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2188961#M51127</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-11-14T19:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates with a tolerance of +- 1 day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2188969#M51130</link>
      <description>&lt;P&gt;Thanks for the reply!&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;This is part of my table. I added column "Days between" so it will be easier to see the difference in days. So in this case "Days between" with row values of 4 is considered "Late", and the row values of 1 is considered "On Time", hence the 1 day tolerance. If the posting date is 2 days after the delivery date, it is considered "Late".&amp;nbsp; Unfortunately your solution resulted in all of the rows showing "Late", but something similiar is what i'm looking for.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Nov 2021 19:56:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2188969#M51130</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-14T19:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates with a tolerance of +- 1 day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2189003#M51135</link>
      <description>&lt;P&gt;HI&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure =&amp;nbsp;&lt;BR /&gt;Var _Dif =&amp;nbsp;Table1[Primised_Receipt_Date] - Table1[Posting_date]return&lt;BR /&gt;If(_Dif&amp;lt;=1,&lt;SPAN&gt;"On Time","Late")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;helps&lt;/SPAN&gt;&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;accepting&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;it as the solution&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Nov 2021 21:43:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2189003#M51135</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-11-14T21:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates with a tolerance of +- 1 day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2189005#M51136</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;Thank you for replying.&lt;BR /&gt;&lt;BR /&gt;Weirdly enough I get this result with Punctunality =&lt;BR /&gt;Var _Dif = Table1[Promised_Receipt_Date] - Table1[Posting_date]return&lt;BR /&gt;If(_Dif&amp;lt;=1,"On Time","Late")&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Nov 2021 22:03:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2189005#M51136</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-14T22:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates with a tolerance of +- 1 day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2189361#M51147</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Do those date columns have Date foramt?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Try this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;New Column=&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If(([Promised_Receipt_Date] - [Posting_date])&amp;lt;=1,"On Time","Late")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;helps&lt;/SPAN&gt;&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;accepting&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;it as the solution&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 04:30:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2189361#M51147</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-11-15T04:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates with a tolerance of +- 1 day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2190651#M51196</link>
      <description>&lt;P&gt;If you've got this column, then you should be able to write&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;IF ( Table1[Days Between] &amp;gt; 1, "Late", "On time" )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 15 Nov 2021 15:54:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2190651#M51196</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-11-15T15:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates with a tolerance of +- 1 day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2190714#M51201</link>
      <description>&lt;P&gt;Unfortunately I get the same result as before. The two columns have date format&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 16:33:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2190714#M51201</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-15T16:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two dates with a tolerance of +- 1 day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2193448#M51326</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may try this Calculated Column or Measure.&lt;/P&gt;
&lt;P&gt;1 Calculated Column&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;IsOnTime = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;datediff_&lt;/SPAN&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SPAN&gt;&lt;SPAN&gt;Table1[Posting_date]&lt;/SPAN&gt;&lt;SPAN&gt; ),&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;Table1[Promised_Receipt_Date]&lt;/SPAN&gt;&lt;SPAN&gt; ),&lt;/SPAN&gt;&lt;SPAN&gt;DAY&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;diff_&lt;/SPAN&gt;&lt;SPAN&gt; &amp;gt;= -&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"OnTime"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Late"&lt;/SPAN&gt;&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, the result should look like this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached the pbix file as reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _ Caiyun&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly. If you still have problems on it or I misunderstand your needs, please feel free to let us know. Thanks a lot!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Nov 2021 04:46:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparing-two-dates-with-a-tolerance-of-1-day/m-p/2193448#M51326</guid>
      <dc:creator>v-cazheng-msft</dc:creator>
      <dc:date>2021-11-17T04:46:17Z</dc:date>
    </item>
  </channel>
</rss>

