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

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

Reply
senorbol
Frequent Visitor

Compound an Accumulated Value over time

Hi All, 

Hope someone can help with this calculation I've got stuck on. I'm looking to compound some accumulated values in my data over the rest of the year. I have data for June, August and July and a calendar table built from June to December. I want to write a dax calculation for compounded values for each month through to December.

My data source in Power BI is just month and saving in the screenshot below.

I've used the following logic in excel (screenshot below)

Coulmn A = Month
Column B = Saving
Column C = Cumulative
Column D = Compounded

Cumulative is calculated as follows Current Column in B + Previous Column in C. Example =C2+B3
Compounded is calculated as follows Current Column in C + Previous Column in D. Example = =D2+C3

The table belows shows the calculations. Is there anyway to write a dax calc to work out the Compounded column?

Compound.png

 




1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@senorbol , To get this first create a date table if you does not have

Calendar =
ADDCOLUMNS (
CALENDAR (DATE(2024, 6, 1), DATE(2024, 12, 31)),
"Month", FORMAT([Date], "MMMM"),
"MonthNumber", MONTH([Date])
)

 

Then you can create a cumulative column using the following DAX:

dax
CumulativeSaving =
CALCULATE (
SUM (SavingsData[Saving]),
FILTER (
ALL (SavingsData),
SavingsData[MonthNumber] <= EARLIER (SavingsData[MonthNumber])
)
)

 

Then create a compound column

CompoundedSaving =
VAR CurrentMonth = SavingsData[MonthNumber]
VAR PreviousCompounded =
CALCULATE (
MAX (SavingsData[CompoundedSaving]),
FILTER (
ALL (SavingsData),
SavingsData[MonthNumber] < CurrentMonth
)
)
RETURN
IF (
ISBLANK (PreviousCompounded),
SavingsData[CumulativeSaving],
SavingsData[CumulativeSaving] + PreviousCompounded
)

 

Ensure that your SavingsData table has a relationship with the Calendar table on the Month column. This will allow you to use the MonthNumber for sorting and calculations




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

1 REPLY 1
bhanu_gautam
Super User
Super User

@senorbol , To get this first create a date table if you does not have

Calendar =
ADDCOLUMNS (
CALENDAR (DATE(2024, 6, 1), DATE(2024, 12, 31)),
"Month", FORMAT([Date], "MMMM"),
"MonthNumber", MONTH([Date])
)

 

Then you can create a cumulative column using the following DAX:

dax
CumulativeSaving =
CALCULATE (
SUM (SavingsData[Saving]),
FILTER (
ALL (SavingsData),
SavingsData[MonthNumber] <= EARLIER (SavingsData[MonthNumber])
)
)

 

Then create a compound column

CompoundedSaving =
VAR CurrentMonth = SavingsData[MonthNumber]
VAR PreviousCompounded =
CALCULATE (
MAX (SavingsData[CompoundedSaving]),
FILTER (
ALL (SavingsData),
SavingsData[MonthNumber] < CurrentMonth
)
)
RETURN
IF (
ISBLANK (PreviousCompounded),
SavingsData[CumulativeSaving],
SavingsData[CumulativeSaving] + PreviousCompounded
)

 

Ensure that your SavingsData table has a relationship with the Calendar table on the Month column. This will allow you to use the MonthNumber for sorting and calculations




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.