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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Lizzieleman
Frequent Visitor

Help with DATESINPERIOD

power bi help.png

 

Not sure where I'm going wrong with this calculation, trying to calculate 12 month rolling figure total KwH

 

Any help much appreciated

2 REPLIES 2
Lizzieleman
Frequent Visitor

this didn't initially work but I changed the calendar date to the date from the same table that the kwh data was in.

I was trying to use a date table for the date.

 

Is there a way of calculating the difference between the most recent 12 month period and the same 12 months in the previous year?

 

So I would want to see kwh consumption for the most recent 12 month period (currently Jan 23 to Dec 23) then would like to compare to kwh consumption during jan 22 to dec 22?

 

I know I could calculate a 24 month period and deduct the current 12 month figure. just wondering if theres a more streamlined way of doing this?

 

Thank you for your help

Ahmedx
Super User
Super User

pls try this

CALCULATE(SUM('All sites data'[KwH]),DATESINPRIOD('Calendar'[Date], MAX(Calendar'[Date]), -12,MOUTH ))

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors