Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi,
I am calculating moving average of 3 weeks on a YTD weekly sales data.
Sample Example - Assuming hypothetical data below arranged by weeks from latest weeks as 0 to prior weeks decremented by -1.
In my Visual i want to display latest 7 weeks sales and their moving average.
Any idea how to ignore filters on visual or page while using a window function
---------INPUT DATA---------
Weeks Sales Moving Avg (Rolling 3 weeks)
0 50 60
-1 60 70
-2 70 80
-3 80 90
-4 90 100
-5 100 110
-6 110 120
-7 120 130
-8 130 140
-9 140 150
------------------------Expected OUTPUT-------------------
Weeks Sales Moving Avg (Rolling 3 weeks)
0 50 60
-1 60 70
-2 70 80
-3 80 90
-4 90 100
-5 100 110
-6 110 120
--------------------OUTPUT Achieved --------------
Weeks Sales Moving Avg (Rolling 3 weeks)
0 50 60
-1 60 70
-2 70 80
-3 80 90
-4 90 100
-5 100 110
-6 110 110
Have a filter on visual to include weeks till -6, after using window function as below value for moving average for week -6 is same 110 but ideally we expect 120.
Measure = AverageX( Window(-2, REL,0, REL, SUMMARIZE( ALL(DATA), [Weeks]), Order By ([Weeks], ASC) ), SUm(SAles) )
Solved! Go to Solution.
@pandbh1989
Averagex is an iterator. It triggers row context. We need to do the context transition. So, only SUm(SAles) should not work properly. Wrap this thing with CALCULATE or create a separate measure for Sales.
Based on your scenario, you need to modify the window settings as well.
Try the below measure.
Moving Aveage =
AVERAGEX(
WINDOW(
0, REL,
2, REL,
SUMMARIZE( ALL('Table'), [Weeks]),
ORDERBY([Weeks], ASC) ), [Total Sales]
)
Check out the below screenshot if it works
Hope it will help you.
Regards
sanalytics
If it is your solution then please like and accept it as solution
@pandbh1989
Averagex is an iterator. It triggers row context. We need to do the context transition. So, only SUm(SAles) should not work properly. Wrap this thing with CALCULATE or create a separate measure for Sales.
Based on your scenario, you need to modify the window settings as well.
Try the below measure.
Moving Aveage =
AVERAGEX(
WINDOW(
0, REL,
2, REL,
SUMMARIZE( ALL('Table'), [Weeks]),
ORDERBY([Weeks], ASC) ), [Total Sales]
)
Check out the below screenshot if it works
Hope it will help you.
Regards
sanalytics
If it is your solution then please like and accept it as solution
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
11 | |
9 | |
8 | |
8 |