<?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: Date time comparison with NOW() function in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-time-comparison-with-NOW-function/m-p/2998357#M101122</link>
    <description>&lt;P&gt;Works like a charm!!!&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jan 2023 11:02:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-01-03T11:02:09Z</dc:date>
    <item>
      <title>Date time comparison with NOW() function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-time-comparison-with-NOW-function/m-p/2998257#M101114</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;I have an issue with comparing two datetime values.&lt;BR /&gt;The goal is to mark all the rows of data that are within 6:00:00 AM &lt;U&gt;3 days ago&lt;/U&gt; and 6:00:00 AM &lt;U&gt;today:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;img /&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you may see upper expression returns NO for datetime that is within last 3 days and i do not understand why is that.&lt;BR /&gt;Two clues:&lt;/P&gt;&lt;P&gt;1. When i am doing IF statement only for &lt;STRONG&gt;IF&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;CurrentRowDate&amp;gt;=Is3Day&lt;/STRONG&gt;&amp;nbsp;it returns only datetime rows for past year. Condistion is not meet for current year.&lt;/P&gt;&lt;P&gt;2. Previously report was build for periods midnight to midnight, i wasn't including time part - it worked.&lt;/P&gt;&lt;P&gt;Can someone please explain what is goind on? DateTime column is Date/Time format but maybe it is still the case of different formatting used in expression?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 09:57:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-time-comparison-with-NOW-function/m-p/2998257#M101114</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-03T09:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Date time comparison with NOW() function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-time-comparison-with-NOW-function/m-p/2998337#M101119</link>
      <description>&lt;P&gt;I think the problem is that FORMAT is returning a string, so the IF statement is comparing 2 string values. Try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Within last 3 days =
VAR Is3Day =
    TODAY () - 3
        + TIME ( 6, 0, 0 )
VAR IsToday =
    TODAY () + TIME ( 6, 0, 0 )
RETURN
    IF ( 'Table'[DateTime] &amp;gt;= Is3Day &amp;amp;&amp;amp; 'Table'[DateTime] &amp;lt;= IsToday, "Yes", "No" )
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 03 Jan 2023 10:46:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-time-comparison-with-NOW-function/m-p/2998337#M101119</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-01-03T10:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Date time comparison with NOW() function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-time-comparison-with-NOW-function/m-p/2998356#M101121</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;The way you are using FORMAT the NOW() is considered as text in the calculation. This can be tested easily by removing the FORMAT from the dax:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Column2 = &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; _now =&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;NOW&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; _3now = &lt;/SPAN&gt;&lt;SPAN&gt;NOW&lt;/SPAN&gt;&lt;SPAN&gt;()-&lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; _col = 'Table (16)'[Column1]&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(_col&amp;gt;=_3now &amp;amp;&amp;amp; _col&amp;lt;=_now,&lt;/SPAN&gt;&lt;SPAN&gt;"Yes"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"No"&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;To get full hours you can use this kind of dax:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Column 3 = &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; _now = &lt;/SPAN&gt;&lt;SPAN&gt;TODAY&lt;/SPAN&gt;&lt;SPAN&gt;() + &lt;/SPAN&gt;&lt;SPAN&gt;TIME&lt;/SPAN&gt;&lt;S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t;/DIV&gt;
&lt;/DIV&gt;
&lt;SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;End results:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;SPAN&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;BR /&gt;&lt;BR /&gt;My LinkedIn: &lt;A href="https://www.linkedin.com/in/n%C3%A4ttiahov-00001/" target="_blank"&gt;https://www.linkedin.com/in/n%C3%A4ttiahov-00001/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Jan 2023 10:59:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-time-comparison-with-NOW-function/m-p/2998356#M101121</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2023-01-03T10:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Date time comparison with NOW() function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-time-comparison-with-NOW-function/m-p/2998357#M101122</link>
      <description>&lt;P&gt;Works like a charm!!!&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 11:02:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-time-comparison-with-NOW-function/m-p/2998357#M101122</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-03T11:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Date time comparison with NOW() function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-time-comparison-with-NOW-function/m-p/2998363#M101124</link>
      <description>&lt;P&gt;Thanks to all of you who participated in the conversation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&amp;nbsp; his solution i checked first and it worked so i marked as a solution but&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;input is also very useful!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 11:04:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-time-comparison-with-NOW-function/m-p/2998363#M101124</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-03T11:04:43Z</dc:date>
    </item>
  </channel>
</rss>

