<?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 M-Code for Dynamic Date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/M-Code-for-Dynamic-Date/m-p/2033136#M45601</link>
    <description>&lt;P&gt;Hello All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to modify this M-Code so that it is only keeping data for the last 5 years beginning on or after 1 Oct of that 5th year. As an example, right now in 2021 I would want data all the way back to 1 Oct 16. However, I need this to be dynamic so that it always just calculates 5 years back and to 1 Oct of the 5th year----no matter what year we are currently in. Another example: In 2023, I'll want it to look at data &amp;gt;= 1 Oct of 2018.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using Power Query it wants a "year" for the 1 Oct date. How do I modify this so that it does not require a year on the 1 Oct date?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;= &lt;SPAN&gt;Table.SelectRows&lt;/SPAN&gt;(#"Changed Type", each &lt;SPAN&gt;Date.IsInPreviousNYears&lt;/SPAN&gt;([Date Arrived Personnel Office], 5) and [Date Arrived Personnel Office] &amp;gt;= #date(2016, 10, 1))&lt;/P&gt;</description>
    <pubDate>Mon, 23 Aug 2021 18:08:57 GMT</pubDate>
    <dc:creator>Userpath77</dc:creator>
    <dc:date>2021-08-23T18:08:57Z</dc:date>
    <item>
      <title>M-Code for Dynamic Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/M-Code-for-Dynamic-Date/m-p/2033136#M45601</link>
      <description>&lt;P&gt;Hello All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to modify this M-Code so that it is only keeping data for the last 5 years beginning on or after 1 Oct of that 5th year. As an example, right now in 2021 I would want data all the way back to 1 Oct 16. However, I need this to be dynamic so that it always just calculates 5 years back and to 1 Oct of the 5th year----no matter what year we are currently in. Another example: In 2023, I'll want it to look at data &amp;gt;= 1 Oct of 2018.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using Power Query it wants a "year" for the 1 Oct date. How do I modify this so that it does not require a year on the 1 Oct date?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;= &lt;SPAN&gt;Table.SelectRows&lt;/SPAN&gt;(#"Changed Type", each &lt;SPAN&gt;Date.IsInPreviousNYears&lt;/SPAN&gt;([Date Arrived Personnel Office], 5) and [Date Arrived Personnel Office] &amp;gt;= #date(2016, 10, 1))&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 18:08:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/M-Code-for-Dynamic-Date/m-p/2033136#M45601</guid>
      <dc:creator>Userpath77</dc:creator>
      <dc:date>2021-08-23T18:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: M-Code for Dynamic Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/M-Code-for-Dynamic-Date/m-p/2033474#M45622</link>
      <description>&lt;P&gt;Please try using this filter step instead&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Table.SelectRows&lt;/SPAN&gt;&lt;SPAN&gt;(#"Changed Type", each&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;[Date Arrived Personnel Office] &amp;gt;= #date(Date.Year(DateTime.LocalNow())-5, 10, 1))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 23:40:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/M-Code-for-Dynamic-Date/m-p/2033474#M45622</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2021-08-23T23:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: M-Code for Dynamic Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/M-Code-for-Dynamic-Date/m-p/2035863#M45674</link>
      <description>&lt;P&gt;Thanks Pat. It worked perfect!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 19:14:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/M-Code-for-Dynamic-Date/m-p/2035863#M45674</guid>
      <dc:creator>Userpath77</dc:creator>
      <dc:date>2021-08-24T19:14:46Z</dc:date>
    </item>
  </channel>
</rss>

