Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 48576

Re: Rolling average by week number

$
0
0



 

One way to get the 4 weeks' rolling AVG. Sort by weekNo ascending and create an index column.

 

Capture.PNG

 

Then create a calculated column as

 

4 weeks' rolling avg = 
SUMX (
    FILTER (
        ALL ( Table4 ),
        Table4[Index] <= EARLIER ( Table4[Index] )&& Table4[Index]> EARLIER ( Table4[Index] ) - 4
    ),
    Table4[sales]
)
    / COUNTX (
        FILTER (
            ALL ( Table4 ),
            Table4[Index] <= EARLIER ( Table4[Index] )&& Table4[Index]> EARLIER ( Table4[Index] ) - 4
        ),
        Table4[WeekNo]
    )

Capture.PNG


Viewing all articles
Browse latest Browse all 48576

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>