<?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 Rolling Average for last 3 filtered entries in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Average-for-last-3-filtered-entries/m-p/2563721#M73005</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with muiltiple columns, i would like to have a rolling average measure that can bne displayed in a card.&lt;/P&gt;&lt;P&gt;I have a table as shown with a ObjectKey column which is a consecutive increment number.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have a weight column that i would filter using slicers on Line, Scale and Station.&lt;/P&gt;&lt;P&gt;Once i select the slicer values i would like a card to display the rolling average for the last 3 entries for that selection.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have the following code so far, but seems to be far from what i want to achieve.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rolling average = 
VAR _lastrow = CALCULATE(MIN('processlog'[ObjectKey]),FILTER(ALL('processlog'),[Weight]=BLANK()))
RETURN
CALCULATE(AVERAGE('processlog'[Weight]),FILTER(ALL('processlog'),[ObjectKey]&amp;lt;=_lastrow-1&amp;amp;&amp;amp;[ObjectKey]&amp;gt;=_lastrow-3))&lt;/LI-CODE&gt;&lt;P&gt;Any advice is most welcome...&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jun 2022 11:26:36 GMT</pubDate>
    <dc:creator>sfwannabe</dc:creator>
    <dc:date>2022-06-07T11:26:36Z</dc:date>
    <item>
      <title>Rolling Average for last 3 filtered entries</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Average-for-last-3-filtered-entries/m-p/2563721#M73005</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with muiltiple columns, i would like to have a rolling average measure that can bne displayed in a card.&lt;/P&gt;&lt;P&gt;I have a table as shown with a ObjectKey column which is a consecutive increment number.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have a weight column that i would filter using slicers on Line, Scale and Station.&lt;/P&gt;&lt;P&gt;Once i select the slicer values i would like a card to display the rolling average for the last 3 entries for that selection.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have the following code so far, but seems to be far from what i want to achieve.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rolling average = 
VAR _lastrow = CALCULATE(MIN('processlog'[ObjectKey]),FILTER(ALL('processlog'),[Weight]=BLANK()))
RETURN
CALCULATE(AVERAGE('processlog'[Weight]),FILTER(ALL('processlog'),[ObjectKey]&amp;lt;=_lastrow-1&amp;amp;&amp;amp;[ObjectKey]&amp;gt;=_lastrow-3))&lt;/LI-CODE&gt;&lt;P&gt;Any advice is most welcome...&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 11:26:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Average-for-last-3-filtered-entries/m-p/2563721#M73005</guid>
      <dc:creator>sfwannabe</dc:creator>
      <dc:date>2022-06-07T11:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Average for last 3 filtered entries</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Average-for-last-3-filtered-entries/m-p/2570446#M73397</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="251144" data-lia-user-login="sfwannabe" class="lia-mention lia-mention-user"&gt;sfwannabe&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rolling average = 
VAR _lastrow =
    CALCULATE ( MIN ( 'processlog'[ObjectKey] ), ALLSELECTED ( 'processlog' ) )
RETURN
    CALCULATE (
        AVERAGE ( 'processlog'[Weight] ),
        'processlog'[ObjectKey] &amp;gt;= _lastrow,
        'processlog'[ObjectKey] &amp;lt;= _lastrow + 2
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the measure above will only return values when the filtered ObjectKey is&amp;nbsp;consecutive. If the filtered ObjectKey is&amp;nbsp;intermittent, it is suggested to use TOPN function. And it can also work for&amp;nbsp;consecutive ObjectKey.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rolling average 2 = 
VAR _last3row =
    TOPN ( 3, ALLSELECTED ( processlog ), [ObjectKey], ASC )
RETURN
    AVERAGEX ( _last3row, [Weight] )
&lt;/LI-CODE&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;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Icey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 03:07:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Average-for-last-3-filtered-entries/m-p/2570446#M73397</guid>
      <dc:creator>Icey</dc:creator>
      <dc:date>2022-06-10T03:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Average for last 3 filtered entries</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Average-for-last-3-filtered-entries/m-p/2573430#M73611</link>
      <description>&lt;P&gt;So my rolling average is now good... however,&amp;nbsp; i would like to display the rolling average for each station...&lt;/P&gt;&lt;P&gt;But some stations dont have data, how do i get the filter working on teh card if i cant select the missing data card?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jun 2022 22:40:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Average-for-last-3-filtered-entries/m-p/2573430#M73611</guid>
      <dc:creator>sfwannabe</dc:creator>
      <dc:date>2022-06-12T22:40:14Z</dc:date>
    </item>
  </channel>
</rss>

