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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.