<?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: 7 day moving average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/7-day-moving-average/m-p/2393375#M62333</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try using this:&lt;/P&gt;&lt;P&gt;TotalSales = Sum(Sales)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Avg Sales (MA 7 days) =&lt;BR /&gt;//Selecting the date in the range&lt;BR /&gt;VAR _LastDate =&lt;BR /&gt;MAX(Calendar[Date] )&lt;/P&gt;&lt;P&gt;VAR _Duration = 7&amp;nbsp;&amp;nbsp;//Defining the duration to be considered for average calculation(k)&lt;BR /&gt;//For filtering the Calendar Table for the defined range&lt;BR /&gt;VAR_CalculationPeriod =&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL(Calendar ),&lt;BR /&gt;AND(Calendar[Date] &amp;gt; _LastDate — _Duration, — the range start date&lt;BR /&gt;Calendar[Date] &amp;lt;= _LastDate — the range end date&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;VAR _MovingAverage =&lt;BR /&gt;IF (COUNTROWS ( _CalculationPeriod ) &amp;gt;= _Duration,&amp;nbsp;&lt;BR /&gt;CALCULATE(AVERAGEX(Calendar,[TotalSales]),&amp;nbsp;_CalculationPeriod))&lt;BR /&gt;RETURN&lt;BR /&gt;_MovingAverage&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;-&amp;gt; Please hit the thumbs up &amp;amp; mark it as a solution if it works for you. Thank you.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Mar 2022 18:44:03 GMT</pubDate>
    <dc:creator>truptis</dc:creator>
    <dc:date>2022-03-14T18:44:03Z</dc:date>
    <item>
      <title>7 day moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/7-day-moving-average/m-p/2393121#M62318</link>
      <description>&lt;P&gt;I really have zero DAX experience.&amp;nbsp; I even tried to add a column and then enter an Excel formula at first.&amp;nbsp; Of course after digging in a little I realized that it doesn't work that way in this case.&amp;nbsp; I am using direct query from a SQL database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My query data looks like the below table - and I am trying to add the final 7 day moving average column.&amp;nbsp; In short, I need to sum the quantity ordered on each date and then calculate the 7 day moving average on those sums.&amp;nbsp; I would then add that data to the line graph below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the best way to go about doing this?&amp;nbsp; In addiiton, is there a particular trainng course I can take to come up to speed?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 16:38:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/7-day-moving-average/m-p/2393121#M62318</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-14T16:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: 7 day moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/7-day-moving-average/m-p/2393375#M62333</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try using this:&lt;/P&gt;&lt;P&gt;TotalSales = Sum(Sales)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Avg Sales (MA 7 days) =&lt;BR /&gt;//Selecting the date in the range&lt;BR /&gt;VAR _LastDate =&lt;BR /&gt;MAX(Calendar[Date] )&lt;/P&gt;&lt;P&gt;VAR _Duration = 7&amp;nbsp;&amp;nbsp;//Defining the duration to be considered for average calculation(k)&lt;BR /&gt;//For filtering the Calendar Table for the defined range&lt;BR /&gt;VAR_CalculationPeriod =&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL(Calendar ),&lt;BR /&gt;AND(Calendar[Date] &amp;gt; _LastDate — _Duration, — the range start date&lt;BR /&gt;Calendar[Date] &amp;lt;= _LastDate — the range end date&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;VAR _MovingAverage =&lt;BR /&gt;IF (COUNTROWS ( _CalculationPeriod ) &amp;gt;= _Duration,&amp;nbsp;&lt;BR /&gt;CALCULATE(AVERAGEX(Calendar,[TotalSales]),&amp;nbsp;_CalculationPeriod))&lt;BR /&gt;RETURN&lt;BR /&gt;_MovingAverage&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;-&amp;gt; Please hit the thumbs up &amp;amp; mark it as a solution if it works for you. Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 18:44:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/7-day-moving-average/m-p/2393375#M62333</guid>
      <dc:creator>truptis</dc:creator>
      <dc:date>2022-03-14T18:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: 7 day moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/7-day-moving-average/m-p/2400159#M62766</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please check the measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = CALCULATE(SUM('Table'[qtyordered]),FILTER(ALLSELECTED('Table'),'Table'[orderdate]&amp;gt;SELECTEDVALUE('Table'[orderdate])-7&amp;amp;&amp;amp;'Table'[orderdate]&amp;lt;=SELECTEDVALUE('Table'[orderdate])))/7&lt;/LI-CODE&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;Jay&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 09:41:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/7-day-moving-average/m-p/2400159#M62766</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-17T09:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: 7 day moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/7-day-moving-average/m-p/2403655#M63025</link>
      <description>&lt;P&gt;truptis - thank you for this.&amp;nbsp; I couldn't figure out how to modify it for my report, but that's all on me.&amp;nbsp; The measure that was suggested seems to be working great though, so I have a working model now.&amp;nbsp; Again, thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 16:05:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/7-day-moving-average/m-p/2403655#M63025</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-18T16:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: 7 day moving average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/7-day-moving-average/m-p/2403657#M63026</link>
      <description>&lt;P&gt;jayw - This worked perfectly, thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 16:06:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/7-day-moving-average/m-p/2403657#M63026</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-18T16:06:17Z</dc:date>
    </item>
  </channel>
</rss>

