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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
lstonehouse
Frequent Visitor

Rolling Average of a measure

Hi there,

I'm looking to create a rolling average of staff hours utilisation. 

 

 

In the table I have:
[ID] - ID of staff

[Dates] - Dates

[Utilised Hours] - Booked Utilised Hours for the date

[Total Hours] - Total Booked Hours for the date

 

I've got a measure  [Utilisation] which is

=SUM([Utilised Hours])/SUM([Total Hours])

which gives a percentage utilisation.

 

I'm now looking to plot a month rolling average, so the average utilization within the past month for each date.

 

I've try a number of measures including

 

= CALCULATE( AVERAGEX("Sheet", [Utilisation]), DATESINPERIOD( LastDate(Sheet[Date]), -1, Month))

 

the problem is that this returns exactly the same as [Utilisation].

If you could give me a hand that would be amazing! 
Cheers!

1 ACCEPTED SOLUTION

Thanks, that is a good plan. However the data structure I have a bit more complicated than that and so I'm not sure I'd be able to restructure it this way. I'll keep it in mind next time I am building something.

We fixed our own problem with a measure in the end. We went for...

Rolling Average = CALCULATE(SUMX(Sheet, Sheet[Billable hours]), DATESINPERIOD(Sheet[Date] ,LASTDATE(Sheet[Date] ) , -1, MONTH ))  / CALCULATE( SUMX(Sheet ,Sheet [Hours] ), DATESINPERIOD(Sheet [Date], LASTDATE( SHEET [DateTS] ) , -1, MONTH )) 

so performing the same measure as before, but only over the dates in the rolling period, and it works fine. Hope this helps other people.

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

Take a look here at this article:

https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

 

Should be able to use the same technique I believe. In this case, your rolling average would be your "super group".


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks, that is a good plan. However the data structure I have a bit more complicated than that and so I'm not sure I'd be able to restructure it this way. I'll keep it in mind next time I am building something.

We fixed our own problem with a measure in the end. We went for...

Rolling Average = CALCULATE(SUMX(Sheet, Sheet[Billable hours]), DATESINPERIOD(Sheet[Date] ,LASTDATE(Sheet[Date] ) , -1, MONTH ))  / CALCULATE( SUMX(Sheet ,Sheet [Hours] ), DATESINPERIOD(Sheet [Date], LASTDATE( SHEET [DateTS] ) , -1, MONTH )) 

so performing the same measure as before, but only over the dates in the rolling period, and it works fine. Hope this helps other people.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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