<?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: Last date in period issue when use DatesBetween in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-in-period-issue-when-use-DatesBetween/m-p/4040361#M160202</link>
    <description>&lt;P&gt;I suggest you write some custom time Intelligence. I talk about it here&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://exceleratorbi.com.au/dax-time-intelligence-beginners/" target="_blank"&gt;https://exceleratorbi.com.au/dax-time-intelligence-beginners/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and here (additional features of a good calendar table)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://exceleratorbi.com.au/power-bi-calendar-tables/" target="_blank"&gt;https://exceleratorbi.com.au/power-bi-calendar-tables/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;once you have a monthID column in your calendar table, use that to do your calendar time shift. All you need to do in the filter portion is filter the calendar table, you don't need all that extra datesbetween stuff.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FILTER(ALL(Calendar),Calendar[MonthID] &amp;gt;= MIN(Calendar[MonthID])-[Parameter value] &amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;Calendar[MonthID] &amp;lt;= MIN(Calendar[MonthID]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with the above filter, you can then extract the dates&amp;nbsp;&lt;/P&gt;&lt;P&gt;CALCULATE(MIN(Calendar[Date]),&lt;/P&gt;&lt;P&gt;FILTER(ALL(Calendar),Calendar[MonthID] &amp;gt;= MIN(Calendar[MonthID])-[Parameter value] &amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;Calendar[MonthID] &amp;lt;= MIN(Calendar[MonthID]))&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 13 Jul 2024 06:25:16 GMT</pubDate>
    <dc:creator>MattAllington</dc:creator>
    <dc:date>2024-07-13T06:25:16Z</dc:date>
    <item>
      <title>Last date in period issue when use DatesBetween</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-in-period-issue-when-use-DatesBetween/m-p/4039836#M160177</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's the first time I am posting a question here. Hopefully I do it right.&amp;nbsp; I have a question with Last date issue when use DATESBETWEEN function hope someone can help with.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a parameter table with parameter of 1-12&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have a DimDate table with a InvoiceDate column and End of Month column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am trying to achieve is to calculate sales based on period.&amp;nbsp; If the parameter is 2, then I want to evaluate sales every 2 month as a period.&amp;nbsp; For example, If the [End of Month] is 02/28/2022, then current period is 01/01/2022-02/28/2022, last period should be 11/01/2021-12/31/2021.&amp;nbsp; However when I use the DATESBETWEEN function to get the last period, the last date is not showing as I would like because the last date in each month is differen: the last date in the last period is 12/28/2021, instead of 12/31/2021.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I get the correct last date for the last period? Thank you!&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;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;First Date DatesBetween =&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&gt;&lt;SPAN&gt;*&lt;/SPAN&gt;&lt;SPAN&gt;[Parameter Value]&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;MONTH&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,&lt;/SPAN&gt;&lt;SPAN&gt;DATEADD&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;LASTDATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DimDate&lt;/SPAN&gt;&lt;SPAN&gt;[InvoiceDate]&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;[Parameter Value]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;MONTH&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 16:05:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-in-period-issue-when-use-DatesBetween/m-p/4039836#M160177</guid>
      <dc:creator>QQB</dc:creator>
      <dc:date>2024-07-12T16:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Last date in period issue when use DatesBetween</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-in-period-issue-when-use-DatesBetween/m-p/4040361#M160202</link>
      <description>&lt;P&gt;I suggest you write some custom time Intelligence. I talk about it here&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://exceleratorbi.com.au/dax-time-intelligence-beginners/" target="_blank"&gt;https://exceleratorbi.com.au/dax-time-intelligence-beginners/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and here (additional features of a good calendar table)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://exceleratorbi.com.au/power-bi-calendar-tables/" target="_blank"&gt;https://exceleratorbi.com.au/power-bi-calendar-tables/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;once you have a monthID column in your calendar table, use that to do your calendar time shift. All you need to do in the filter portion is filter the calendar table, you don't need all that extra datesbetween stuff.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FILTER(ALL(Calendar),Calendar[MonthID] &amp;gt;= MIN(Calendar[MonthID])-[Parameter value] &amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;Calendar[MonthID] &amp;lt;= MIN(Calendar[MonthID]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with the above filter, you can then extract the dates&amp;nbsp;&lt;/P&gt;&lt;P&gt;CALCULATE(MIN(Calendar[Date]),&lt;/P&gt;&lt;P&gt;FILTER(ALL(Calendar),Calendar[MonthID] &amp;gt;= MIN(Calendar[MonthID])-[Parameter value] &amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;Calendar[MonthID] &amp;lt;= MIN(Calendar[MonthID]))&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jul 2024 06:25:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-in-period-issue-when-use-DatesBetween/m-p/4040361#M160202</guid>
      <dc:creator>MattAllington</dc:creator>
      <dc:date>2024-07-13T06:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Last date in period issue when use DatesBetween</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-in-period-issue-when-use-DatesBetween/m-p/4042575#M160326</link>
      <description>&lt;P&gt;Thank you! your suggested solution is so much better!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 13:19:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-in-period-issue-when-use-DatesBetween/m-p/4042575#M160326</guid>
      <dc:creator>QQB</dc:creator>
      <dc:date>2024-07-15T13:19:02Z</dc:date>
    </item>
  </channel>
</rss>

