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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
tom1tas
Frequent Visitor

Get Moving Average from an existing measure

Hey Everyone, thanks for checking my message,
I am trying to get a cummulative average  but I dont know how, can you help me?

Currently my power BI data is designed the following way, my headcount data  is calculated using this measure 

Current HC = CALCULATE(SUM('Forecast Query'[Forecast Value]),'Forecast Query'[Forecast Date]==MAX('Forecast Query'[Forecast Date])) so power bi wont allow me to do an average of my measure, please help me identify how to get the cummulative average column shown below.

 

DateHeadcountLeaves     Cummulative Average Headcount

Cummulative leaves

 

1/1/2022   200 10  20010
2/1/2022   201 7  200.517
3/1/2022  198  3  197.66666720
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @tom1tas ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1676426872751.png

2. create a measure with below dax formula

Cummulative Average Headcount =
VAR cur_date =
    SELECTEDVALUE ( 'Table'[Date] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Date] <= cur_date )
RETURN
    AVERAGEX ( tmp, [Head count] )

3. add a table visual with fields and measure

vbinbinyumsft_1-1676426952119.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @tom1tas ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1676426872751.png

2. create a measure with below dax formula

Cummulative Average Headcount =
VAR cur_date =
    SELECTEDVALUE ( 'Table'[Date] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Date] <= cur_date )
RETURN
    AVERAGEX ( tmp, [Head count] )

3. add a table visual with fields and measure

vbinbinyumsft_1-1676426952119.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hey thank you it worked with tha date table, how about getting the moving average for the same measure (CALCULATE(SUM('Forecast Query'[Forecast Value]),'Forecast Query'[Forecast Date]==MAX('Forecast Query'[Forecast Date])) )- but now filtered by another attribute, company.  The default date will be a year/month slicer. 

I need help with two errors, the first one is that my cummulative leaves measure will not work when I change the table columns to agency, I  need it to do a running total for all the leaves previous to the slicer selected date. Same for the moving average of the headcount, it would need to be calculated from all the dates previous to the slicer selected date .

CompanyHeadcout MeasureLeavesCummulative Leaves (Failing)Average HC(Failing)
sports 1   
streaming55   
gaming1   
mma155 
mba19   
cereals1   
kids books10055 
tom1tas
Frequent Visitor

Notice time intelligence functions will not work because the measure of the headcount is not calculated on continuous date data.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors