<?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: Rolling 6 months with a variable number of months on the x-axis in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-6-months-with-a-variable-number-of-months-on-the-x-axis/m-p/3448832#M131311</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="437706" data-lia-user-login="Jo_Swinnen" class="lia-mention lia-mention-user"&gt;Jo_Swinnen&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can use the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SAMEPERIODLASTYEAR&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;function to calculate the rolling 12 months based on the same period of the previous year.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total 12 months = CALCULATE([Total], SAMEPERIODLASTYEAR(‘Dim Date’[Date]))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the PARALLELPERIOD function to calculate the rolling 12 months based on a specified number of intervals in the past or future.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total 12 months = CALCULATE([Total], PARALLELPERIOD(‘Dim Date’[Date], -12, MONTH))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;BR /&gt;Community Support Team _ Rongtie&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&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>Wed, 27 Sep 2023 03:01:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-09-27T03:01:19Z</dc:date>
    <item>
      <title>Rolling 6 months with a variable number of months on the x-axis</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-6-months-with-a-variable-number-of-months-on-the-x-axis/m-p/3446587#M131151</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've created several measures in my report to make visualisations with a variable number of months on the x-axis by using a numeric parameter 'number of months'.&lt;/P&gt;&lt;P&gt;For instance:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total=&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;sum([Revenue])&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;DATESINPERIOD&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Dim Date'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Dim Date'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;),-&lt;/SPAN&gt;&lt;SPAN&gt;[Number of months]&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;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;By placing a slicer on the month_year in Dim date and a slicer with the numeric parameter and on the x axis I placed a month_year column out of the fact table, the number of months are variable.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But now I want the rolling 12 months also in this visualisation.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But I get the same results as the total measure.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I tried two measures:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Total 12 months = CALCULATE([Total],&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;DATESINPERIOD&lt;/SPAN&gt;&lt;SPAN&gt;('Dim Date'[Date],&lt;/SPAN&gt;&lt;SPAN&gt;max&lt;/SPAN&gt;&lt;SPAN&gt;('Dim Date'[Date]),-12&lt;/SPAN&gt;&lt;SPAN&gt;,MONTH))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total 12 months = CALCULATE(CALCULATE([Total],&lt;SPAN&gt;DATESINPERIOD&lt;/SPAN&gt;&lt;SPAN&gt;('Dim Date'[Date],&lt;/SPAN&gt;&lt;SPAN&gt;max&lt;/SPAN&gt;&lt;SPAN&gt;('Dim Date'[Date]),-12&lt;/SPAN&gt;&lt;SPAN&gt;,MONTH),&amp;nbsp;DATESINPERIOD('Dim Date'[Date],MAX('Dim Date'[Date]),-[Number of months],MONTH))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Can anyone help?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Jo&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 Sep 2023 19:31:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-6-months-with-a-variable-number-of-months-on-the-x-axis/m-p/3446587#M131151</guid>
      <dc:creator>Jo_Swinnen</dc:creator>
      <dc:date>2023-09-25T19:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 6 months with a variable number of months on the x-axis</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-6-months-with-a-variable-number-of-months-on-the-x-axis/m-p/3448832#M131311</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="437706" data-lia-user-login="Jo_Swinnen" class="lia-mention lia-mention-user"&gt;Jo_Swinnen&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can use the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SAMEPERIODLASTYEAR&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;function to calculate the rolling 12 months based on the same period of the previous year.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total 12 months = CALCULATE([Total], SAMEPERIODLASTYEAR(‘Dim Date’[Date]))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the PARALLELPERIOD function to calculate the rolling 12 months based on a specified number of intervals in the past or future.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total 12 months = CALCULATE([Total], PARALLELPERIOD(‘Dim Date’[Date], -12, MONTH))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;BR /&gt;Community Support Team _ Rongtie&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&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>Wed, 27 Sep 2023 03:01:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-6-months-with-a-variable-number-of-months-on-the-x-axis/m-p/3448832#M131311</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-27T03:01:19Z</dc:date>
    </item>
  </channel>
</rss>

