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
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

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.

View solution in original post

1 REPLY 1

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.

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.

Top Solution Authors