Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
CloudMonkey
Post Prodigy
Post Prodigy

Moving average formula error

Hi,

 

I have a simple formula that's meant to find the moving average for the number of weeks as selected from a slicer. My problem is that it is changing the scale on my x axis. When I select a 2 month moving average the x axis extends one week to the right, and when I select a 12 week moving average it extends the x asix 11 weeks to the right. Please can anyone explain why it's doing this and how to stop it?

 

Revenue (adjustable weeks moving average) = 
VAR
    MovingAverageEndWeek = max('Calendar - Days'[Calendar Date (week bins)])
VAR
    MovingAverageStartWeek = MovingAverageEndWeek - 7*(selectedvalue('Selected Integers'[Integars])-1)
RETURN
    CALCULATE([Revenue],
'Calendar - Days'[Calendar Date (week bins)] >= MovingAverageStartWeek &&
'Calendar - Days'[Calendar Date (week bins)] <= MovingAverageEndWeek)

 

Thanks,

 

CM 

1 REPLY 1
v-kelly-msft
Community Support
Community Support

Hi @CloudMonkey ,

 

Sorry but I cant reproduce your scenario ,could you pls upload some screenshots to make it more clear?

 

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.