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
senterlm
New Member

Running Total of a Moving Average

There many post on Running Totals and Moving Averages separately.

 

I have successfully used moving average to extrapolate a future forecast

Cost Moving Average = AVERAGEX(DATESINPERIOD('calendar'[date_field],CALCULATE(LASTDATE('calendar'[date_field]),All('calendar'[fiscal_month_desc])),-4,MONTH),sum(cost[Cost]))
but the Running Total measure of the moving average measure returns the same result as the Moving Average, not the cummulative sum of the Moving Average for the filter context(looking quarter by quarter)
Quarter Cumulative Cost Moving Average = CALCULATE([Cost Moving Average],FILTER(all('calendar'),'calendar'[date_field]<=max('calendar'[date_field])))
 
I assume this is because there are not real values for these period in the fact table, or the Moving Average isn't coming from a real fact table.  I tried to create a query table for the moving average by the fields I want to be able to slice on, but was unsuccessful.  Any ideas?

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your expected visualization looks like, but could you please try the below whether it suits your requirement?

 

Quarter Cumulative Cost Moving Average =
CALCULATE (
    SUMX ( VALUES ( 'calendar'[date_field] ), [Cost Moving Average] ),
    FILTER (
        ALL ( 'calendar' ),
        'calendar'[date_field] <= MAX ( 'calendar'[date_field] )
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your expected visualization looks like, but could you please try the below whether it suits your requirement?

 

Quarter Cumulative Cost Moving Average =
CALCULATE (
    SUMX ( VALUES ( 'calendar'[date_field] ), [Cost Moving Average] ),
    FILTER (
        ALL ( 'calendar' ),
        'calendar'[date_field] <= MAX ( 'calendar'[date_field] )
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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.