<?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 Overdue in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Overdue/m-p/3062902#M105933</link>
    <description>&lt;P&gt;Here's a PowerQuery custom field expression and DAX equivalent. Prefer the PowerQuery version for performance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As PowerQuery, note that I've assumed that I can generalize 1 month = 31 days:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if Duration.Days(Duration.From([rental end]-DateTime.Date(DateTime.LocalNow()))) &amp;lt;= -31 then "flag overdue" else if Duration.Days(Duration.From([rental end]-DateTime.Date(DateTime.LocalNow()))) &amp;lt; 0 then "overdue" else if Duration.Days(Duration.From([rental end]-DateTime.Date(DateTime.LocalNow()))) &amp;lt;= 14 then "rental near overdue" else "-"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a DAX calculated column expression equivalent:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;status = SWITCH(&lt;BR /&gt;TRUE()&lt;BR /&gt;, DATEDIFF(TODAY(), Rentals[rental end], DAY) &amp;lt;= -31, "flag overdue"&lt;BR /&gt;, DATEDIFF(TODAY(), Rentals[rental end], DAY) &amp;lt; 0, "overdue"&lt;BR /&gt;, DATEDIFF(TODAY(), Rentals[rental end], DAY) &amp;lt; 14, "rental near overdue"&lt;BR /&gt;, "-"&lt;BR /&gt;)&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Note that the Power BI service runs DAX NOW() and TODAY() in UTC, and I believe it will with PowerQuery date expressions too, so be careful comparing things with the current date if being a day out is a problem. This issue won't be visible in Power BI Desktop, but will be visible on the published report.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Service/Set-local-time-zone-Power-BI-Service/m-p/114120#:~:text=power%20bi%20service%20operates%20in%20the%20utc%20time%20zone%2C%20and%20evaluates%20all%20locale%20based%20time%20functions%20in%20that%20time%20zone" target="_blank" rel="noopener"&gt;Power BI service operates in the UTC time zone, and evaluates all locale based time functions in that time zone&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The following article describes the issue around relative date slicers, but the same issue occurs with comparisons to the current date. It also describes how to resolve the issue:&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://radacad.com/relative-date-slicer-for-your-local-time-zone-in-power-bi" target="_blank" rel="noopener"&gt;https://radacad.com/relative-date-slicer-for-your-local-time-zone-in-power-bi&lt;/A&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 06 Feb 2023 03:54:08 GMT</pubDate>
    <dc:creator>andrewpirie</dc:creator>
    <dc:date>2023-02-06T03:54:08Z</dc:date>
    <item>
      <title>Date Overdue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Overdue/m-p/3062778#M105925</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;hi I want to ask, so I have data like this rental start and rental end, I want the output in the SLA column if today's date is close to the rental end date then the output will be "near overdue", if today's date has reached the rental end then the output will be "overdue" but if today's date has passed from the rental end date maybe about a month then the output will be "flag overdue"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Thanks in Advance!!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 02:39:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Overdue/m-p/3062778#M105925</guid>
      <dc:creator>Robyrubyjane</dc:creator>
      <dc:date>2023-02-06T02:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Date Overdue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Overdue/m-p/3062902#M105933</link>
      <description>&lt;P&gt;Here's a PowerQuery custom field expression and DAX equivalent. Prefer the PowerQuery version for performance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As PowerQuery, note that I've assumed that I can generalize 1 month = 31 days:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if Duration.Days(Duration.From([rental end]-DateTime.Date(DateTime.LocalNow()))) &amp;lt;= -31 then "flag overdue" else if Duration.Days(Duration.From([rental end]-DateTime.Date(DateTime.LocalNow()))) &amp;lt; 0 then "overdue" else if Duration.Days(Duration.From([rental end]-DateTime.Date(DateTime.LocalNow()))) &amp;lt;= 14 then "rental near overdue" else "-"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a DAX calculated column expression equivalent:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;status = SWITCH(&lt;BR /&gt;TRUE()&lt;BR /&gt;, DATEDIFF(TODAY(), Rentals[rental end], DAY) &amp;lt;= -31, "flag overdue"&lt;BR /&gt;, DATEDIFF(TODAY(), Rentals[rental end], DAY) &amp;lt; 0, "overdue"&lt;BR /&gt;, DATEDIFF(TODAY(), Rentals[rental end], DAY) &amp;lt; 14, "rental near overdue"&lt;BR /&gt;, "-"&lt;BR /&gt;)&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Note that the Power BI service runs DAX NOW() and TODAY() in UTC, and I believe it will with PowerQuery date expressions too, so be careful comparing things with the current date if being a day out is a problem. This issue won't be visible in Power BI Desktop, but will be visible on the published report.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Service/Set-local-time-zone-Power-BI-Service/m-p/114120#:~:text=power%20bi%20service%20operates%20in%20the%20utc%20time%20zone%2C%20and%20evaluates%20all%20locale%20based%20time%20functions%20in%20that%20time%20zone" target="_blank" rel="noopener"&gt;Power BI service operates in the UTC time zone, and evaluates all locale based time functions in that time zone&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The following article describes the issue around relative date slicers, but the same issue occurs with comparisons to the current date. It also describes how to resolve the issue:&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://radacad.com/relative-date-slicer-for-your-local-time-zone-in-power-bi" target="_blank" rel="noopener"&gt;https://radacad.com/relative-date-slicer-for-your-local-time-zone-in-power-bi&lt;/A&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 06 Feb 2023 03:54:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Overdue/m-p/3062902#M105933</guid>
      <dc:creator>andrewpirie</dc:creator>
      <dc:date>2023-02-06T03:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Date Overdue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Overdue/m-p/3062939#M105937</link>
      <description>&lt;P&gt;omg, it worked&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":loudly_crying_face:"&gt;😭&lt;/span&gt; Thank you so much&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 04:29:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Overdue/m-p/3062939#M105937</guid>
      <dc:creator>Robyrubyjane</dc:creator>
      <dc:date>2023-02-06T04:29:10Z</dc:date>
    </item>
  </channel>
</rss>

