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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
kruizing
Frequent Visitor

Rolling sum for month to month usage

Hi!

I have a table in which the meter readings of my energy meters are stored every hour of the day. I have made a measure which calculates the consumption per month. Now I would like to have a rolling sum to calculate the annual consumption from month to month. For example, I want to make a line graph with in January 2020 the consumption of 01-2019 - 01/2020, in February the consumption of 02-2019 - 02-2020, March 2020 the consumption of 03-2019 - 03-2020.

 

My measurement for the monthly gas usage is as follows:

 

 

GasVerbruikMaandMutatie = CALCULATE([GasVerbruikPeriode], DATEADD(Kalender[Date],-0,MONTH))
GasVerbruikPeriode = CALCULATE(MAX(Energie[Gas])-(MIN(Energie[Gas])),Energie[Datum])

 

 

 

My table look like this:

 

 

I hope there is somebody who can help me out.

 

Thank you  very much in advance!

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

Instead of DATEADD, try DATESINPERIOD. This function extends the dates back (or forward) the amount you choose. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

1 REPLY 1
MattAllington
Community Champion
Community Champion

Instead of DATEADD, try DATESINPERIOD. This function extends the dates back (or forward) the amount you choose. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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