<?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 Weekly rolling average to appear in weeks with no values in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weekly-rolling-average-to-appear-in-weeks-with-no-values/m-p/3233964#M118765</link>
    <description>&lt;P&gt;Hello, no DAX expert here but curious to know the solution. I have a martix table in PBI with 5 layers of detail: week num, region, cat, sub cat, sub cat 2. I need to calculate rolling averages for each level of detail, which is fine until I get to the most granular level, sub cat 2, which doesn't have actual values to average every week. I still, however, want to see the rolling average. Is there a way to do that?&lt;/P&gt;&lt;P&gt;&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;This is how we calc rolling averages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much in advance!!!!!&lt;/P&gt;</description>
    <pubDate>Sat, 13 May 2023 23:34:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-05-13T23:34:53Z</dc:date>
    <item>
      <title>Weekly rolling average to appear in weeks with no values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weekly-rolling-average-to-appear-in-weeks-with-no-values/m-p/3233964#M118765</link>
      <description>&lt;P&gt;Hello, no DAX expert here but curious to know the solution. I have a martix table in PBI with 5 layers of detail: week num, region, cat, sub cat, sub cat 2. I need to calculate rolling averages for each level of detail, which is fine until I get to the most granular level, sub cat 2, which doesn't have actual values to average every week. I still, however, want to see the rolling average. Is there a way to do that?&lt;/P&gt;&lt;P&gt;&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;This is how we calc rolling averages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much in advance!!!!!&lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 23:34:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weekly-rolling-average-to-appear-in-weeks-with-no-values/m-p/3233964#M118765</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-13T23:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Weekly rolling average to appear in weeks with no values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weekly-rolling-average-to-appear-in-weeks-with-no-values/m-p/3234547#M118839</link>
      <description>&lt;P&gt;Hi ,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your image and description , you want to calcuate the previous 4weeks rolling average.And you also want to calcualte when it has no value.&lt;/P&gt;
&lt;P&gt;Here are the steps you can refer to :&lt;BR /&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 like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table 2 = DISTINCT( SELECTCOLUMNS('Table',"Region",'Table'[Region],"Major Cat",'Table'[Major Cat] , "Sub Cat",'Table'[Sub Cat] , "Sub Cat2" , 'Table'[Sub Cat2]))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(3)Then we need to click "New Measure" to create a measure like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 2 = var _cur_cat2 = MAX('Table 2'[Sub Cat2])
var _cur_sub = MAX('Table 2'[Sub Cat])
var _major_cat = MAX('Table 2'[Major Cat])
var _region = MAX('Table 2'[Region])
var _week = MAX('Table'[Week_Sort])
var _t =  FILTER( ALLSELECTED('Table') , 'Table'[Region]=_region &amp;amp;&amp;amp; 'Table'[Major Cat]=_major_cat &amp;amp;&amp;amp; 'Table'[Sub Cat] = _cur_sub &amp;amp;&amp;amp; 'Table'[Sub Cat2]=_cur_cat2 &amp;amp;&amp;amp;  'Table'[Week_Sort]&amp;lt;= _week &amp;amp;&amp;amp;'Table'[Week_Sort]&amp;gt;_week-4)
return
IF(_week&amp;lt;4 , BLANK() ,SUMX(_t,[Weekly Sales])/4 )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then we can put these fields on the visual and we can get this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!&amp;nbsp;&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 02:19:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weekly-rolling-average-to-appear-in-weeks-with-no-values/m-p/3234547#M118839</guid>
      <dc:creator>v-yueyunzh-msft</dc:creator>
      <dc:date>2023-05-15T02:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Weekly rolling average to appear in weeks with no values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weekly-rolling-average-to-appear-in-weeks-with-no-values/m-p/3236326#M118966</link>
      <description>&lt;P&gt;Thank you very much, Aniya - i believe this will do it!&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 19:12:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weekly-rolling-average-to-appear-in-weeks-with-no-values/m-p/3236326#M118966</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-15T19:12:35Z</dc:date>
    </item>
  </channel>
</rss>

