<?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 How to compare today's date and specific time with another date column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4293605#M170403</link>
    <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please advise how to address this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need to get 3 flags as below. Start Date is my columj in data source which has date and time in it.&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Set flag to Yes &lt;STRONG&gt;if Start date is from current date 9 pm to current date +7days&amp;nbsp; 6 am&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;Set flag Yes if start date is from Tuesday next week 9 pm till Tuesday of Next week + 28 days at 6 am&lt;/LI&gt;&lt;LI&gt;Set flag Yes if start date&amp;nbsp; is from Friday of current week 9 pm till Friday of current + 25 days at 6 am&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Really appreciate if someone can help&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2024 15:29:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-20T15:29:53Z</dc:date>
    <item>
      <title>How to compare today's date and specific time with another date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4293605#M170403</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please advise how to address this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need to get 3 flags as below. Start Date is my columj in data source which has date and time in it.&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Set flag to Yes &lt;STRONG&gt;if Start date is from current date 9 pm to current date +7days&amp;nbsp; 6 am&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;Set flag Yes if start date is from Tuesday next week 9 pm till Tuesday of Next week + 28 days at 6 am&lt;/LI&gt;&lt;LI&gt;Set flag Yes if start date&amp;nbsp; is from Friday of current week 9 pm till Friday of current + 25 days at 6 am&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Really appreciate if someone can help&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 15:29:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4293605#M170403</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-20T15:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare today's date and specific time with another date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4293656#M170406</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, Try using below steps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a calculated column for the current date and time:&lt;BR /&gt;CurrentDateTime = NOW()&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Create a calculated column for the start of the day (9 PM) and end of the day (6 AM) for the current date:&lt;BR /&gt;CurrentDate9PM = DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY())) + TIME(21, 0, 0)&lt;BR /&gt;CurrentDatePlus7Days6AM = DATE(YEAR(TODAY() + 7), MONTH(TODAY() + 7), DAY(TODAY() + 7)) + TIME(6, 0, 0)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Create a calculated column for the start and end of the period for Tuesday next week:&lt;BR /&gt;NextTuesday9PM = DATE(YEAR(TODAY() + (8 - WEEKDAY(TODAY(), 2))), MONTH(TODAY() + (8 - WEEKDAY(TODAY(), 2))), DAY(TODAY() + (8 - WEEKDAY(TODAY(), 2)))) + TIME(21, 0, 0)&lt;BR /&gt;NextTuesdayPlus28Days6AM = DATE(YEAR(TODAY() + (8 - WEEKDAY(TODAY(), 2)) + 28), MONTH(TODAY() + (8 - WEEKDAY(TODAY(), 2)) + 28), DAY(TODAY() + (8 - WEEKDAY(TODAY(), 2)) + 28)) + TIME(6, 0, 0)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Create a calculated column for the start and end of the period for Friday of the current week:&lt;BR /&gt;ThisFriday9PM = DATE(YEAR(TODAY() + (6 - WEEKDAY(TODAY(), 2))), MONTH(TODAY() + (6 - WEEKDAY(TODAY(), 2))), DAY(TODAY() + (6 - WEEKDAY(TODAY(), 2)))) + TIME(21, 0, 0)&lt;BR /&gt;ThisFridayPlus25Days6AM = DATE(YEAR(TODAY() + (6 - WEEKDAY(TODAY(), 2)) + 25), MONTH(TODAY() + (6 - WEEKDAY(TODAY(), 2)) + 25), DAY(TODAY() + (6 - WEEKDAY(TODAY(), 2)) + 25)) + TIME(6, 0, 0)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Create the flags based on the conditions:&lt;BR /&gt;DAX&lt;BR /&gt;Flag1 = IF(&lt;BR /&gt;'Table'[Start Date] &amp;gt;= [CurrentDate9PM] &amp;amp;&amp;amp; 'Table'[Start Date] &amp;lt;= [CurrentDatePlus7Days6AM],&lt;BR /&gt;"Yes",&lt;BR /&gt;"No"&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Flag2 = IF(&lt;BR /&gt;'Table'[Start Date] &amp;gt;= [NextTuesday9PM] &amp;amp;&amp;amp; 'Table'[Start Date] &amp;lt;= [NextTuesdayPlus28Days6AM],&lt;BR /&gt;"Yes",&lt;/P&gt;
&lt;P&gt;These calculated columns will set the flags based on the specified date and time ranges. Make sure to replace 'Table' with the actual name of your table in Power BI.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 15:53:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4293656#M170406</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2024-11-20T15:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare today's date and specific time with another date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4293803#M170413</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create three calculated columns:&lt;/P&gt;&lt;PRE&gt;Flag_1 = &lt;BR /&gt;VAR CurrentDate = TODAY()&lt;BR /&gt;VAR StartWindow = CurrentDate + TIME(21, 0, 0) // Current date 9 PM&lt;BR /&gt;VAR EndWindow = CurrentDate + 7 + TIME(6, 0, 0) // Current date +7 days 6 AM&lt;BR /&gt;RETURN&lt;BR /&gt;IF (&lt;BR /&gt;'Table'[Start Date] &amp;gt;= StartWindow &amp;amp;&amp;amp;&lt;BR /&gt;'Table'[Start Date] &amp;lt;= EndWindow,&lt;BR /&gt;"Yes",&lt;BR /&gt;"No"&lt;BR /&gt;)&lt;/PRE&gt;&lt;PRE&gt;Flag_2 = &lt;BR /&gt;VAR CurrentDate = TODAY()&lt;BR /&gt;VAR DaysToTuesday = 3 - WEEKDAY(CurrentDate, 2) // Get days to next Tuesday (2-based week)&lt;BR /&gt;VAR NextTuesday = CurrentDate + IF(DaysToTuesday &amp;lt; 0, DaysToTuesday + 7, DaysToTuesday)&lt;BR /&gt;VAR StartWindow = NextTuesday + TIME(21, 0, 0) // Next Tuesday 9 PM&lt;BR /&gt;VAR EndWindow = NextTuesday + 28 + TIME(6, 0, 0) // +28 days 6 AM&lt;BR /&gt;RETURN&lt;BR /&gt;IF (&lt;BR /&gt;'Table'[Start Date] &amp;gt;= StartWindow &amp;amp;&amp;amp;&lt;BR /&gt;'Table'[Start Date] &amp;lt;= EndWindow,&lt;BR /&gt;"Yes",&lt;BR /&gt;"No"&lt;BR /&gt;)&lt;/PRE&gt;&lt;PRE&gt;Flag_3 = &lt;BR /&gt;VAR CurrentDate = TODAY()&lt;BR /&gt;VAR DaysToFriday = 5 - WEEKDAY(CurrentDate, 2) // Get days to Friday (2-based week)&lt;BR /&gt;VAR ThisFriday = CurrentDate + IF(DaysToFriday &amp;lt; 0, DaysToFriday + 7, DaysToFriday)&lt;BR /&gt;VAR StartWindow = ThisFriday + TIME(21, 0, 0) // This Friday 9 PM&lt;BR /&gt;VAR EndWindow = ThisFriday + 25 + TIME(6, 0, 0) // +25 days 6 AM&lt;BR /&gt;RETURN&lt;BR /&gt;IF (&lt;BR /&gt;'Table'[Start Date] &amp;gt;= StartWindow &amp;amp;&amp;amp;&lt;BR /&gt;'Table'[Start Date] &amp;lt;= EndWindow,&lt;BR /&gt;"Yes",&lt;BR /&gt;"No"&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;Let me know if you'd like further refinements!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008080"&gt;&lt;STRONG&gt;&lt;span class="lia-unicode-emoji" title=":love_letter:"&gt;💌&lt;/span&gt; If this helped, a Kudos &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; or Solution mark would be great! &lt;span class="lia-unicode-emoji" title=":party_popper:"&gt;🎉&lt;/span&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Kedar&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/kedar-pande" target="_blank" rel="noopener"&gt;Connect on LinkedIn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 17:15:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4293803#M170413</guid>
      <dc:creator>Kedar_Pande</dc:creator>
      <dc:date>2024-11-20T17:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare today's date and specific time with another date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4294363#M170434</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;Thanks for the reply from&amp;nbsp;bhanu_gautam&amp;nbsp;and&amp;nbsp;Kedar_Pande&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ashish_18, you can also try the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My sample:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create three calculated columns as follows.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Flag 1 = 
VAR _CurrentDate = TODAY()
VAR _StartTime = TIME(21, 0, 0)
VAR _EndTime = TIME(6, 0, 0)
VAR _StartDateTime = _CurrentDate + _StartTime
VAR _EndDateTime = _CurrentDate + 7 + _EndTime
RETURN 
IF(
    'Table'[Start Date] &amp;gt;= _StartDateTime &amp;amp;&amp;amp; 'Table'[Start Date] &amp;lt;= _EndDateTime,
    "Yes",
    "No"
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Flag 2 = 
VAR _CurrentDate = TODAY()
VAR _StartTime = TIME(21, 0, 0)
VAR _EndTime = TIME(6, 0, 0)
VAR _DaysToNextTuesday = MOD(2 - WEEKDAY(_CurrentDate, 2) + 7, 7)
VAR _TuesdayNextWeek = _CurrentDate + _DaysToNextTuesday
VAR _StartDateTime = _TuesdayNextWeek + _StartTime
VAR _EndDateTime = _TuesdayNextWeek + 28 + _EndTime
RETURN 
IF(
    'Table'[Start Date] &amp;gt;= _StartDateTime &amp;amp;&amp;amp; 'Table'[Start Date] &amp;lt;= _EndDateTime,
    "Yes",
    "No"
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Flag 3 = 
VAR _CurrentDate = TODAY()
VAR _StartTime = TIME(21, 0, 0)
VAR _EndTime = TIME(6, 0, 0)
VAR _DaysToFriday = MOD(5 - WEEKDAY(_CurrentDate, 2) + 7, 7)
VAR _FridayThisWeek = _CurrentDate + _DaysToFriday
VAR _StartDateTime = _FridayThisWeek + _StartTime
VAR _EndDateTime = _FridayThisWeek + 25 + _EndTime
RETURN 
IF(
    'Table'[Start Date] &amp;gt;= _StartDateTime &amp;amp;&amp;amp; 'Table'[Start Date] &amp;lt;= _EndDateTime,
    "Yes",
    "No"
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yulia Xu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 02:55:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4294363#M170434</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-21T02:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare today's date and specific time with another date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4295458#M170494</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="568855" data-lia-user-login="Kedar_Pande" class="lia-mention lia-mention-user"&gt;Kedar_Pande&lt;/a&gt;&amp;nbsp; Thansk for your response. I am creating claulated columns as u stated. Fisrt flag works fine but other 2 I could not test due to no data. I will keep validating it and if I face any issue ,I will let u know..thnx again&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 14:19:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4295458#M170494</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-21T14:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare today's date and specific time with another date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4295460#M170495</link>
      <description>&lt;P&gt;Thanks for your response. I will try using this code&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 14:20:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4295460#M170495</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-21T14:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare today's date and specific time with another date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4295463#M170496</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;, I will try on this code as well. As of now,I tried other 2 solution and its working for me. As my validations not done yet,I will refer these as well&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 14:21:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-today-s-date-and-specific-time-with-another-date/m-p/4295463#M170496</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-21T14:21:56Z</dc:date>
    </item>
  </channel>
</rss>

