Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi,
I need to add the following formula to a table, but I am not sure how to get the sum of the last 6 months dynamically, not including this month..
My formula should be as follows =(2 * SUM("COST ON THE LAST 6 MONTHS")) / (SUM("ITEMS IN THE LAST 6 MONTH")/6)
The table is by day and it also has an item id.
Thanks! Astrid
Hi @AstridM ,
Measure =
var 6Monthscost = CALCULATE(SUM('Table'[cost]), DATESINPERIOD(Date[Date],ENDOFMONTH('Table'[Date]), -6, MONTH))
var 6Monthsitem = CALCULATE(SUM('Table'[item]), DATESINPERIOD(Date[Date],ENDOFMONTH('Table'[Date]), -6, MONTH))
var div = DIVIDE( 6Monthsitem ,6)
RETURN
DIVIDE(2*6Monthscost , div)
Regards,
Harsh Nathani
Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.