<?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 3 Month Formula result is the same as actual month in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4268793#M169262</link>
    <description>&lt;P&gt;Thanks for your reply - sorry I haven't responded but I've been away for a few days - I'll test this as soon as I get a chance and let you know how I get on.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Mon, 04 Nov 2024 08:26:50 GMT</pubDate>
    <dc:creator>matratus28</dc:creator>
    <dc:date>2024-11-04T08:26:50Z</dc:date>
    <item>
      <title>Rolling 3 Month Formula result is the same as actual month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4258061#M168711</link>
      <description>&lt;P&gt;Hi - I'm trying to calculate rolling 3 month sales using DAX in Power Pivot, but when I pull my measure into my pivot it just gives me the same value as for the actuals for that month. - can you please help?&lt;BR /&gt;&lt;BR /&gt;I have an actuals table with a &lt;STRONG&gt;Total_Sales&lt;/STRONG&gt; column.&lt;/P&gt;&lt;P&gt;I have created a &lt;STRONG&gt;Sales&lt;/STRONG&gt; measure with -&amp;nbsp;&lt;!--  StartFragment   --&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;Sales:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;SUM&lt;/SPAN&gt;&lt;SPAN class=""&gt;(t_actuals[Total_Sales])&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;BR /&gt;Sales are at a product level so there are multiple rows for each week/month in the table.&lt;BR /&gt;&lt;BR /&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;The actuals table has a week column in &lt;STRONG&gt;YYYYWW&lt;/STRONG&gt;&amp;nbsp;format which is joined to a calendar table in the same format.&lt;BR /&gt;The calendar table has a &lt;STRONG&gt;YYYYMM&lt;/STRONG&gt;&amp;nbsp;column (for period) and a &lt;STRONG&gt;period&amp;nbsp;start date &lt;/STRONG&gt;in dd/mm/yyyy format&lt;STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;To try and create a rolling 3 month/period calculation I have written this but it gives me the actuals for each period and not the 3 month average.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rolling 3 Month Sales:=
CALCULATE([Sales],

DATESINPERIOD(

t_calendar[Period start date],

MAX(t_calendar[Period start date]),

-3,

MONTH

)

)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pivot result:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Long period&lt;/TD&gt;&lt;TD&gt;Period start date&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;Rolling 3 Month Sales&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202407&lt;/TD&gt;&lt;TD&gt;30/09/2023&lt;/TD&gt;&lt;TD&gt;£1,850,155&lt;/TD&gt;&lt;TD&gt;£1,850,155&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202408&lt;/TD&gt;&lt;TD&gt;28/10/2023&lt;/TD&gt;&lt;TD&gt;£7,950,967&lt;/TD&gt;&lt;TD&gt;£7,950,967&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202409&lt;/TD&gt;&lt;TD&gt;25/11/2023&lt;/TD&gt;&lt;TD&gt;£11,401,870&lt;/TD&gt;&lt;TD&gt;£11,401,870&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202410&lt;/TD&gt;&lt;TD&gt;30/12/2023&lt;/TD&gt;&lt;TD&gt;£7,160,039&lt;/TD&gt;&lt;TD&gt;£7,160,039&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202411&lt;/TD&gt;&lt;TD&gt;27/01/2024&lt;/TD&gt;&lt;TD&gt;£9,384,733&lt;/TD&gt;&lt;TD&gt;£9,384,733&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202412&lt;/TD&gt;&lt;TD&gt;24/02/2024&lt;/TD&gt;&lt;TD&gt;£11,124,963&lt;/TD&gt;&lt;TD&gt;£11,124,963&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202501&lt;/TD&gt;&lt;TD&gt;01/04/2024&lt;/TD&gt;&lt;TD&gt;£9,041,011&lt;/TD&gt;&lt;TD&gt;£9,041,011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202502&lt;/TD&gt;&lt;TD&gt;27/04/2024&lt;/TD&gt;&lt;TD&gt;£10,867,145&lt;/TD&gt;&lt;TD&gt;£10,867,145&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202503&lt;/TD&gt;&lt;TD&gt;01/06/2024&lt;/TD&gt;&lt;TD&gt;£7,907,225&lt;/TD&gt;&lt;TD&gt;£7,907,225&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202504&lt;/TD&gt;&lt;TD&gt;29/06/2024&lt;/TD&gt;&lt;TD&gt;£8,902,636&lt;/TD&gt;&lt;TD&gt;£8,902,636&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202505&lt;/TD&gt;&lt;TD&gt;27/07/2024&lt;/TD&gt;&lt;TD&gt;£10,833,004&lt;/TD&gt;&lt;TD&gt;£10,833,004&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202506&lt;/TD&gt;&lt;TD&gt;31/08/2024&lt;/TD&gt;&lt;TD&gt;£8,693,422&lt;/TD&gt;&lt;TD&gt;£8,693,422&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202507&lt;/TD&gt;&lt;TD&gt;28/09/2024&lt;/TD&gt;&lt;TD&gt;£8,417,511&lt;/TD&gt;&lt;TD&gt;£8,417,511&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 25 Oct 2024 12:26:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4258061#M168711</guid>
      <dc:creator>matratus28</dc:creator>
      <dc:date>2024-10-25T12:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 3 Month Formula result is the same as actual month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4258197#M168717</link>
      <description>&lt;P&gt;Update to this - the measure works correctly if I remove "Long Period" from the pivot and just have Period start date in the pivot.&lt;BR /&gt;Thanks for looking &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 13:54:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4258197#M168717</guid>
      <dc:creator>matratus28</dc:creator>
      <dc:date>2024-10-25T13:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 3 Month Formula result is the same as actual month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4258720#M168743</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="615168" data-lia-user-login="matratus28" class="lia-mention lia-mention-user"&gt;matratus28&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It sounds like the issue was related to filter context in your pivot table. When you included "Long Period" (likely referring to a higher-level grouping like YYYYMM), it might have affected the way the DATESINPERIOD function evaluated the rolling 3-month window.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here’s how you can refine the measure to ensure it works regardless of which fields are used in the pivot:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rolling 3 Month Sales :=
CALCULATE(
    [Sales],
    DATESINPERIOD(
        t_calendar[Period start date],
        MAX(t_calendar[Period start date]),
        -3,
        MONTH
    ),
    ALL(t_calendar[YYYYMM])  -- Ignores Long Period context
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;You can try using the ALL function to remove the influence of "Long Period" from the filter context, ensuring your measure behaves consistently across different fields in the pivot.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2024 01:28:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4258720#M168743</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2024-10-26T01:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 3 Month Formula result is the same as actual month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4259906#M168807</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="615168" data-lia-user-login="matratus28" class="lia-mention lia-mention-user"&gt;matratus28&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much&amp;nbsp;DataNinja777&amp;nbsp;for your prompt reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pls try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rolling 3 Month Sales :=
CALCULATE(
    [Sales],
    DATESINPERIOD(
        t_calendar[Period start date],
        MAX(t_calendar[Period start date]),
        -3,
        MONTH
    ),
    REMOVEFILTERS(t_calendar[Long Period])  // This line removes the filter context from Long Period
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this &lt;STRONG&gt;&lt;EM&gt;post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 05:50:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4259906#M168807</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-28T05:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 3 Month Formula result is the same as actual month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4268790#M169261</link>
      <description>&lt;P&gt;Hi DataNinja777 - thanks for taking the time to reply. I've been on holiday for the last week and so hadn't seen this. I'll hopefully get chance to test it later in the week and I'll let you know how I get on.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 08:24:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4268790#M169261</guid>
      <dc:creator>matratus28</dc:creator>
      <dc:date>2024-11-04T08:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 3 Month Formula result is the same as actual month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4268793#M169262</link>
      <description>&lt;P&gt;Thanks for your reply - sorry I haven't responded but I've been away for a few days - I'll test this as soon as I get a chance and let you know how I get on.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 08:26:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-3-Month-Formula-result-is-the-same-as-actual-month/m-p/4268793#M169262</guid>
      <dc:creator>matratus28</dc:creator>
      <dc:date>2024-11-04T08:26:50Z</dc:date>
    </item>
  </channel>
</rss>

