<?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 Moving or Rolling Average KPI in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-or-Rolling-Average-KPI/m-p/3055893#M105416</link>
    <description>&lt;P&gt;Dear comunity friends.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a saving KPI for a procurement department in power BI based on a moving average of the cost paid for the items.&lt;/P&gt;&lt;P&gt;To reach this goal I did use the below DAX formula to calculate the moving average of the values with a certain sucsess, but I need something a little more complex, I need the formula to calculate the moving average for the last year and then to use it as a base for the whole next year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table I have is this one:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the formula I am using is this one:&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;SMA - SIMPLE MOVING AVERAGE = 
if(ISBLANK('Medidas'[Média Ponderada]),BLANK(),AVERAGEX(
    DATESBETWEEN(dCalendario[Data],MAX(dCalendario[Data])-366,MAX(dCalendario[Data])-30),
    CALCULATE(sumx('dCalendario',Medidas[Média Ponderada]))))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the table I'd like for example that the last moving average of 2021 in the example 335,77 to be the moving average for the whole 2022.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you can help me.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2023 18:40:52 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-02-01T18:40:52Z</dc:date>
    <item>
      <title>Moving or Rolling Average KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-or-Rolling-Average-KPI/m-p/3055893#M105416</link>
      <description>&lt;P&gt;Dear comunity friends.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a saving KPI for a procurement department in power BI based on a moving average of the cost paid for the items.&lt;/P&gt;&lt;P&gt;To reach this goal I did use the below DAX formula to calculate the moving average of the values with a certain sucsess, but I need something a little more complex, I need the formula to calculate the moving average for the last year and then to use it as a base for the whole next year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table I have is this one:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the formula I am using is this one:&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;SMA - SIMPLE MOVING AVERAGE = 
if(ISBLANK('Medidas'[Média Ponderada]),BLANK(),AVERAGEX(
    DATESBETWEEN(dCalendario[Data],MAX(dCalendario[Data])-366,MAX(dCalendario[Data])-30),
    CALCULATE(sumx('dCalendario',Medidas[Média Ponderada]))))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the table I'd like for example that the last moving average of 2021 in the example 335,77 to be the moving average for the whole 2022.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you can help me.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 18:40:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-or-Rolling-Average-KPI/m-p/3055893#M105416</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-01T18:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Moving or Rolling Average KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-or-Rolling-Average-KPI/m-p/3056606#M105460</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; ,&lt;/P&gt;
&lt;P&gt;YTD Avg = CALCULATE(AvergaeX(Values('Date'[Month Year]), CALCULATE(SUM(Sales[Sales Amount]))),DATESYTD('Date'[Date],"12/31"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;next YTD Avg = CALCULATE(AvergaeX(Values('Date'[Month Year]), CALCULATE(SUM(Sales[Sales Amount]))),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Time Intelligence, Part of learn Power BI &lt;A href="https://youtu.be/cN8AO3_vmlY?t=27510" target="_blank"&gt;https://youtu.be/cN8AO3_vmlY?t=27510&lt;/A&gt;&lt;BR /&gt;Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period, &lt;BR /&gt;Custom Period till date: &lt;A href="https://youtu.be/aU2aKbnHuWs&amp;amp;t=145s" target="_blank"&gt;https://youtu.be/aU2aKbnHuWs&amp;amp;t=145s&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 02:23:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-or-Rolling-Average-KPI/m-p/3056606#M105460</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2023-02-02T02:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Moving or Rolling Average KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-or-Rolling-Average-KPI/m-p/3057616#M105528</link>
      <description>&lt;P&gt;Hello Amit. Thanks for your prompt help. I'll adapt your formula to my data and I'll let you know the results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 10:52:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-or-Rolling-Average-KPI/m-p/3057616#M105528</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-02T10:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Moving or Rolling Average KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-or-Rolling-Average-KPI/m-p/3058177#M105577</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;I've been able to use it but dates are not matching and I think it is because I do not have the&amp;nbsp;&lt;SPAN&gt;'Date'[Month Year] on my calendar table. In your calendar table do you use january/23 or 01/23? I'll add also a colum with the format you use this way I think it will work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The formula now is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;YTD Avg = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Medidas'&lt;/SP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PAN&gt;&lt;SPAN&gt;)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The result was:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last column is the one with the formula, and if you can see it on january 2023 it isn't showing any data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you can help me once again.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Feb 2023 15:10:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Moving-or-Rolling-Average-KPI/m-p/3058177#M105577</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-02T15:10:35Z</dc:date>
    </item>
  </channel>
</rss>

