<?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: Measure to Filter out Values Based on Current Time in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-out-Values-Based-on-Current-Time/m-p/3604139#M139259</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="571780" data-lia-user-login="victoryamaykin" class="lia-mention lia-mention-user"&gt;victoryamaykin&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So did you test this measure ?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Dec 2023 19:59:42 GMT</pubDate>
    <dc:creator>Fowmy</dc:creator>
    <dc:date>2023-12-27T19:59:42Z</dc:date>
    <item>
      <title>Measure to Filter out Values Based on Current Time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-out-Values-Based-on-Current-Time/m-p/3603941#M139255</link>
      <description>&lt;P&gt;I'm working on an operational dashboard to show production by location.&lt;BR /&gt;When the executive looks at the dashboard in the early morning before store hours, I want them to see yesterday's production numbers.&lt;BR /&gt;After 9 am, I want them to start seeing today's production. How do I filter based on the current time?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here's the if statement I'm testing:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;// IF the current hour is before 9 am&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TIME&lt;/SPAN&gt;&lt;SPAN&gt;(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bsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;DATEADD&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FactTagProduction&lt;/SPAN&gt;&lt;SPAN&gt;[DateID]&lt;/SPAN&gt;&lt;SPAN&gt;, -&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;Day&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ),&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// ELSE show today's numbers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FactTagProduction&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;[ValueStocked]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FactTagProduction&lt;/SPAN&gt;&lt;SPAN&gt;[DateID]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;TODAY&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 27 Dec 2023 20:08:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-out-Values-Based-on-Current-Time/m-p/3603941#M139255</guid>
      <dc:creator>victoryamaykin</dc:creator>
      <dc:date>2023-12-27T20:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Filter out Values Based on Current Time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-out-Values-Based-on-Current-Time/m-p/3604139#M139259</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="571780" data-lia-user-login="victoryamaykin" class="lia-mention lia-mention-user"&gt;victoryamaykin&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So did you test this measure ?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2023 19:59:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-out-Values-Based-on-Current-Time/m-p/3604139#M139259</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2023-12-27T19:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Filter out Values Based on Current Time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-out-Values-Based-on-Current-Time/m-p/3605109#M139281</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="571780" data-lia-user-login="victoryamaykin" class="lia-mention lia-mention-user"&gt;victoryamaykin&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;If I understand correctly, the issue is that you want to filter values based on current time. Please &lt;SPAN&gt;try the following methods and check if they can solve your problem:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1.Create the simple table.&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2.Go to the Modeling tab and click on New measure.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3.Create a measure to filter based on the current time. Enter the&amp;nbsp;following DAX formula.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure Numbers = var _date=SELECTEDVALUE(FactTagProduction[DateID])
VAR CurrentHour = HOUR(NOW())
VAR A = YEAR(_date)
VAR B = MONTH(_date)
VAR C = DAY(_date)
VAR D =
CALCULATE(
        SUM(FactTagProduction[ValueStocked]),
        FILTER(
            'FactTagProduction',
        YEAR(TODAY() - 1) = A &amp;amp;&amp;amp; MONTH(TODAY() - 1) = B &amp;amp;&amp;amp; DAY(TODAY() - 1) = C
    )
)
VAR E =
CALCULATE(
        SUM(FactTagProduction[ValueStocked]),
        FILTER(
            'FactTagProduction',
        YEAR(TODAY()) = A &amp;amp;&amp;amp; MONTH(TODAY()) = B &amp;amp;&amp;amp; DAY(TODAY()) = C
    )
)
RETURN
IF(
    CurrentHour &amp;lt; 9,
    D,
    E
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="4"&gt;
&lt;LI&gt;&lt;SPAN&gt; Move the measure numbers to the columns.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;5.The result is shown below.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If the above ones can’t help you get it working, c&lt;SPAN&gt;ould you please provide &lt;/SPAN&gt;more raw data(exclude sensitive data) with Text format or screenshot &lt;SPAN&gt;to make a deep troubleshooting? &lt;/SPAN&gt;It would be helpful to find out the solution.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Looking forward to your reply.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Wisdom Wu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2023 09:45:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-out-Values-Based-on-Current-Time/m-p/3605109#M139281</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-28T09:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Filter out Values Based on Current Time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-out-Values-Based-on-Current-Time/m-p/3605999#M139308</link>
      <description>&lt;P&gt;That worked very well.&amp;nbsp;The only line I had to change was the CurrentHour variable to correspond to my timezone (since the Now() function appears to be UTC by default).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you for your help!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2023 18:08:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-out-Values-Based-on-Current-Time/m-p/3605999#M139308</guid>
      <dc:creator>victoryamaykin</dc:creator>
      <dc:date>2023-12-28T18:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to Filter out Values Based on Current Time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-out-Values-Based-on-Current-Time/m-p/3606004#M139309</link>
      <description>&lt;P&gt;Thank you for your response. The posted solution worked for me. It helped to use the FILTER instead of DATEADD.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2023 18:11:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-Filter-out-Values-Based-on-Current-Time/m-p/3606004#M139309</guid>
      <dc:creator>victoryamaykin</dc:creator>
      <dc:date>2023-12-28T18:11:53Z</dc:date>
    </item>
  </channel>
</rss>

