<?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: Moving average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2849768#M91305</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="458444" data-lia-user-login="Kleine285" class="lia-mention lia-mention-user"&gt;Kleine285&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And here the code:&lt;/P&gt;
&lt;PRE&gt;RollingMeasure = 
VAR _prevYear = YEAR ( SELECTEDVALUE ( 'Table'[Date] ) ) - 1
RETURN
( 
    CALCULATE ( 
        SELECTEDVALUE ( 'Table'[Value] ), 
        ALL   ( 'Table' ),
        YEAR  ( 'Table'[Date] ) = _prevYear, 
        MONTH ( 'Table'[Date] ) = 12
    ) + 
    SELECTEDVALUE ( 'Table'[Value] ) 
) / 2&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this solves your issue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/Tom&lt;BR /&gt;&lt;A href="https://www.tackytech.blog/" target="_blank" rel="noopener"&gt;https://www.tackytech.blog/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank" rel="noopener"&gt;https://www.instagram.com/tackytechtom/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2022 19:25:46 GMT</pubDate>
    <dc:creator>tackytechtom</dc:creator>
    <dc:date>2022-10-18T19:25:46Z</dc:date>
    <item>
      <title>Moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2849671#M91295</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've already looked at and tried some of your examples here, but they don't really help me.&lt;/P&gt;&lt;P&gt;I need to calculate an average that keeps changing/shifting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: Average of January '22 = (December 2021 + January 2021)/2)&lt;BR /&gt;average February '22 = (December 2021 + February 2021)/2)&lt;BR /&gt;March '22 average = (December 2021 + March 2021)/2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I need to have the average of each month with December of the previous year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;I hope the attached table gives an idea of my data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 18:02:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2849671#M91295</guid>
      <dc:creator>Kleine285</dc:creator>
      <dc:date>2022-10-18T18:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2849768#M91305</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="458444" data-lia-user-login="Kleine285" class="lia-mention lia-mention-user"&gt;Kleine285&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And here the code:&lt;/P&gt;
&lt;PRE&gt;RollingMeasure = 
VAR _prevYear = YEAR ( SELECTEDVALUE ( 'Table'[Date] ) ) - 1
RETURN
( 
    CALCULATE ( 
        SELECTEDVALUE ( 'Table'[Value] ), 
        ALL   ( 'Table' ),
        YEAR  ( 'Table'[Date] ) = _prevYear, 
        MONTH ( 'Table'[Date] ) = 12
    ) + 
    SELECTEDVALUE ( 'Table'[Value] ) 
) / 2&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this solves your issue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/Tom&lt;BR /&gt;&lt;A href="https://www.tackytech.blog/" target="_blank" rel="noopener"&gt;https://www.tackytech.blog/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank" rel="noopener"&gt;https://www.instagram.com/tackytechtom/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 19:25:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2849768#M91305</guid>
      <dc:creator>tackytechtom</dc:creator>
      <dc:date>2022-10-18T19:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2851226#M91410</link>
      <description>&lt;P&gt;I think it isn't working form me because the value for me is already a measure. In my example 14.0 = SUMX( Table., table col1 + table col 2 + ....).&lt;/P&gt;&lt;P&gt;&amp;nbsp;How can the solution be amended?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 11:44:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2851226#M91410</guid>
      <dc:creator>Kleine285</dc:creator>
      <dc:date>2022-10-19T11:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2851984#M91463</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="458444" data-lia-user-login="Kleine285" class="lia-mention lia-mention-user"&gt;Kleine285&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please, could you share some sample data as well as the your measures? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/Tom&lt;BR /&gt;&lt;A href="https://www.tackytech.blog/" target="_blank"&gt;https://www.tackytech.blog/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank"&gt;https://www.instagram.com/tackytechtom/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 18:57:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2851984#M91463</guid>
      <dc:creator>tackytechtom</dc:creator>
      <dc:date>2022-10-19T18:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2853991#M91632</link>
      <description>&lt;P&gt;Hi Tom,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any possibility for me to send the files for you? Maybe by email.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;Please find attacted examples of my data and measures.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 15:04:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2853991#M91632</guid>
      <dc:creator>Kleine285</dc:creator>
      <dc:date>2022-10-20T15:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2854914#M91720</link>
      <description>&lt;P&gt;Hi ,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="458444" data-lia-user-login="Kleine285" class="lia-mention lia-mention-user"&gt;Kleine285&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the steps you can refer to :&lt;/P&gt;
&lt;P&gt;(1)This is my test data :&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(2)We need to click "New Table" to create a table because you have a measure [14.0]:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table 2 = ADDCOLUMNS( SUMMARIZE( ALLSELECTED('Table') , 'Table'[Mannd]) , "14.0" , [14.0])&lt;/LI-CODE&gt;
&lt;P&gt;(3)Then we need to create a measure :&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Moving average = var _date =SELECTEDVALUE('Table'[Mannd])
var _last_year_month =MAXX( FILTER( 'Table 2' , [Mannd] = DATE( YEAR( _date) -1 ,MONTH(_date),1)) , [14.0])
var _last_year_dec = MAXX( FILTER( 'Table 2' , [Mannd] = DATE( YEAR( _date) -1 ,12,1)) , [14.0])
 return
DIVIDE( _last_year_month + _last_year_dec , 2)&lt;/LI-CODE&gt;
&lt;P&gt;(4)We can put the filed we need and the measure on the visual and we will meet your need :&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this method does not meet your needs, you can provide us with your special &lt;STRONG&gt;sample data&lt;/STRONG&gt; and the &lt;STRONG&gt;desired output sample&lt;/STRONG&gt; data in the form of &lt;STRONG&gt;tables&lt;/STRONG&gt;, so that we can better help you solve the problem.(You can upload your file to OneDrive , then you can share the OneDrive link to share your file)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Aniya Zhang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt; it as the solution&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 05:40:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2854914#M91720</guid>
      <dc:creator>v-yueyunzh-msft</dc:creator>
      <dc:date>2022-10-21T05:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2855125#M91733</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Aniya Zhang,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm still getting an emty result for the measure.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've added the link to the PBI.file for you to try and work your magic and a screenshot of my desired output. Please don't mind the blank cells in the sample.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/17oW-dq_GRX5fzv0RP7clAv5MdvqQCgYx/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/17oW-dq_GRX5fzv0RP7clAv5MdvqQCgYx/view?usp=sharing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 07:14:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2855125#M91733</guid>
      <dc:creator>Kleine285</dc:creator>
      <dc:date>2022-10-21T07:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2855198#M91739</link>
      <description>&lt;P&gt;Hi ,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="458444" data-lia-user-login="Kleine285" class="lia-mention lia-mention-user"&gt;Kleine285&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I download this .pbix file , the filed in the visual is wrong, youo need to use the [Maand] filed in the 'Measures Mndst' table and [14.0] measure you created before not in the 'Table2'.&lt;/P&gt;
&lt;P&gt;For your need , you should update the measure to this :&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Moving average = var _date =SELECTEDVALUE('Mndst'[Maand])
var _this_year_month =MAXX( FILTER( 'Table 2' , [Maand] = DATE( YEAR( _date)  ,MONTH(_date),1)) , [14.0])
var _last_year_dec = MAXX( FILTER( 'Table 2' , [Maand] = DATE( YEAR( _date) -1 ,12,1)) , [14.0])
 return
IF(_last_year_dec=BLANK(),BLANK(),DIVIDE(_last_year_dec+_this_year_month,2))&lt;/LI-CODE&gt;
&lt;P&gt;The result is follows , i think that is your need :&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Aniya Zhang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;it as the solution&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 07:55:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2855198#M91739</guid>
      <dc:creator>v-yueyunzh-msft</dc:creator>
      <dc:date>2022-10-21T07:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2855368#M91752</link>
      <description>&lt;P&gt;Thank you all, especially Aniya Zhang for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 09:10:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2855368#M91752</guid>
      <dc:creator>Kleine285</dc:creator>
      <dc:date>2022-10-21T09:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2856104#M91808</link>
      <description>&lt;P&gt;Hi Aniya Zhang,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like your help regarding the measure you provided. It seems that I can't filter on institution "Instelling".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make the "Moving Average" measure also work when filtering by insitution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Isstvan&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 17:04:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-average/m-p/2856104#M91808</guid>
      <dc:creator>Kleine285</dc:creator>
      <dc:date>2022-10-21T17:04:59Z</dc:date>
    </item>
  </channel>
</rss>

