<?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: Help needed: Rolling Average of a Indexed Value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3544023#M136256</link>
    <description>&lt;P&gt;can you try below dax:&lt;BR /&gt;&lt;SPAN&gt;RollingAverageIndexedValue = VAR _WindowSize = 7 -- Adjust the window size as needed RETURN AVERAGEX( FILTER( ALLSELECTED(vDimCalendar), vDimCalendar[Date] &amp;gt;= MIN(vDimCalendar[Date]) - _WindowSize + 1 &amp;amp;&amp;amp; vDimCalendar[Date] &amp;lt;= MAX(vDimCalendar[Date]) ), [IndexedValue] )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this helped, Subscribe AnalyticPulse on YouTube for future updates:&lt;BR /&gt;&lt;A href="https://www.youtube.com/@AnalyticPulse" target="_blank"&gt;https://www.youtube.com/@AnalyticPulse&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://instagram.com/analytic_pulse" target="_blank"&gt;https://instagram.com/analytic_pulse&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://analyticpulse.blogspot.com/" target="_blank"&gt;https://analyticpulse.blogspot.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;subscribe to Youtube channel For fun facts:&lt;BR /&gt;&lt;A href="https://www.youtube.com/@CogniJourney" target="_blank"&gt;https://www.youtube.com/@CogniJourney&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Nov 2023 07:51:15 GMT</pubDate>
    <dc:creator>AnalyticPulse</dc:creator>
    <dc:date>2023-11-21T07:51:15Z</dc:date>
    <item>
      <title>Help needed: Rolling Average of a Indexed Value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3543984#M136253</link>
      <description>&lt;P&gt;Hey!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been struggling with this problem for a while. I would like to create a rolling average of this measure here. Basically the measure is transforming the sales to index starting from 100 for selected time period. The measure works well, but when I try to create a rolling average of it I don't get the rolling average to work. I have tried countless of options but none seems to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Index Sales = 
VAR _FirstDate = 
CALCULATE(MIN(vDimCalendar[Date]),
ALLSELECTED(vDimCalendar[Date])
)

VAR ThisDate = SELECTEDVALUE(vDimCalendar[Date])

VAR BaseValue = 
CALCULATE(
    SUM(CubeSales[ACT]),
    DATEADD(vDimCalendar[Date], _FirstDate - ThisDate, DAY))

VAR CurrentValue = CALCULATE(SUM(CubeSales[ACT]))

VAR IndexedValue = DIVIDE(CurrentValue, BaseValue, BLANK()) * 100

RETURN
IndexedValue&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 07:42:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3543984#M136253</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-21T07:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed: Rolling Average of a Indexed Value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3543993#M136254</link>
      <description>&lt;P&gt;Here is something I have tried, but this does not return the correct output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;6 Months Rolling average Index = 
AVERAGEX(
    WINDOW(
        -6, REL,
        0, REL,
        ORDERBY (vDimCalendar[Date], ASC)
    ),
    CALCULATE([Index Sales])
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 21 Nov 2023 07:44:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3543993#M136254</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-21T07:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed: Rolling Average of a Indexed Value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3544023#M136256</link>
      <description>&lt;P&gt;can you try below dax:&lt;BR /&gt;&lt;SPAN&gt;RollingAverageIndexedValue = VAR _WindowSize = 7 -- Adjust the window size as needed RETURN AVERAGEX( FILTER( ALLSELECTED(vDimCalendar), vDimCalendar[Date] &amp;gt;= MIN(vDimCalendar[Date]) - _WindowSize + 1 &amp;amp;&amp;amp; vDimCalendar[Date] &amp;lt;= MAX(vDimCalendar[Date]) ), [IndexedValue] )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this helped, Subscribe AnalyticPulse on YouTube for future updates:&lt;BR /&gt;&lt;A href="https://www.youtube.com/@AnalyticPulse" target="_blank"&gt;https://www.youtube.com/@AnalyticPulse&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://instagram.com/analytic_pulse" target="_blank"&gt;https://instagram.com/analytic_pulse&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://analyticpulse.blogspot.com/" target="_blank"&gt;https://analyticpulse.blogspot.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;subscribe to Youtube channel For fun facts:&lt;BR /&gt;&lt;A href="https://www.youtube.com/@CogniJourney" target="_blank"&gt;https://www.youtube.com/@CogniJourney&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 07:51:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3544023#M136256</guid>
      <dc:creator>AnalyticPulse</dc:creator>
      <dc:date>2023-11-21T07:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed: Rolling Average of a Indexed Value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3544039#M136258</link>
      <description>&lt;P&gt;Hey!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunatelly the measure you provided does not work. It returns 100 for each date.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 07:59:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3544039#M136258</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-21T07:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed: Rolling Average of a Indexed Value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3544062#M136260</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Please try&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Index Sales Running Average =
VAR CurrentDate =
    MAX ( vDimCalendar[Date] )
VAR SelectedDates =
    ALLSELECTED ( vDimCalendar[Date] )
VAR BaseValue =
    CALCULATE ( SUM ( CubeSales[ACT] ), SelectedDates )
VAR DatesBefore =
    FILTER ( SelectedDates, vDimCalendar[Date] &amp;lt;= CurrentDate )
VAR Result =
    AVERAGEX (
        DatesBefore,
        VAR ThisDate = vDimCalendar[Date]
        VAR CurrentValue =
            CALCULATE (
                SUM ( CubeSales[ACT] ),
                ALL ( vDimCalendar ),
                vDimCalendar[Date] = ThisDate
            )
        RETURN
            DIVIDE ( CurrentValue, BaseValue )
    )
RETURN
    Result&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 21 Nov 2023 08:12:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3544062#M136260</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-11-21T08:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed: Rolling Average of a Indexed Value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3553462#M136729</link>
      <description>&lt;P&gt;Hey!&lt;/P&gt;&lt;P&gt;This seems to return correct result. I modified it a bit since it was returning the result for whole timeframe. Also it seems to be very slow, so I might try to optimize it. Anyway thanks for help!&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Index Sales Running Average = 
VAR CurrentDate =
    MAX ( vDimCalendar[Date] )
VAR SelectedDates =
    ALLSELECTED ( vDimCalendar[Date] )
VAR BaseValue =
    CALCULATE ( SUM ( CubeSales[ACT] ), SelectedDates )
VAR DatesBefore =
    FILTER ( SelectedDates, vDimCalendar[Date] &amp;lt;= CurrentDate )
VAR Result =
    AVERAGEX (
        DatesBefore,
        VAR ThisDate = vDimCalendar[Date]
        VAR CurrentValue =
            CALCULATE (
                SUM ( CubeSales[ACT] ),
                ALL ( vDimCalendar ),
                vDimCalendar[Date] = ThisDate
            )
        RETURN
            DIVIDE ( CurrentValue, BaseValue ) * 1000
    )
RETURN
    IF(CurrentDate &amp;lt;= MAX(CubeSales[Date]),
    Result,
    BLANK())&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 27 Nov 2023 07:56:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-needed-Rolling-Average-of-a-Indexed-Value/m-p/3553462#M136729</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-27T07:56:12Z</dc:date>
    </item>
  </channel>
</rss>

