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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
neees78
Helper II
Helper II

Calculated column DAX for cumulative cost saving

Good day all, 

I've the following table - need daily cost to show cumulative savings after each new saving is added in 

Stating at daily cost 100K and then that column should reduce each time new saving is added in

Sorted by Target Date 

 

neees78_0-1676632530727.png

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @neees78 
Please refer to attached sample file with the proposed solution. Hope this is what you're looking for

1.png

Daily Cost = 
VAR StartingValue = 100000
VAR CurrentDate = SELECTEDVALUE ( 'Table'[Target Date] )
VAR CurrentID = SELECTEDVALUE ( 'Table'[ID] )
VAR SelectedTable = ALLSELECTED ( 'Table' )
VAR TableOnAndBefore = 
    FILTER ( 
        SelectedTable, 
        VALUE ( 'Table'[Target Date] ) * 1000000 + 'Table'[ID] 
            <= VALUE ( CurrentDate ) * 1000000 + CurrentID 
    )
VAR AccumulatedSaving = SUMX ( TableOnAndBefore, 'Table'[New Savinng] )
RETURN
    IF ( 
        HASONEVALUE ( 'Table'[ID] ),
        StartingValue - AccumulatedSaving
    )

View solution in original post

8 REPLIES 8
tamerj1
Super User
Super User

Hi @neees78 
Please refer to attached sample file with the proposed solution. Hope this is what you're looking for

1.png

Daily Cost = 
VAR StartingValue = 100000
VAR CurrentDate = SELECTEDVALUE ( 'Table'[Target Date] )
VAR CurrentID = SELECTEDVALUE ( 'Table'[ID] )
VAR SelectedTable = ALLSELECTED ( 'Table' )
VAR TableOnAndBefore = 
    FILTER ( 
        SelectedTable, 
        VALUE ( 'Table'[Target Date] ) * 1000000 + 'Table'[ID] 
            <= VALUE ( CurrentDate ) * 1000000 + CurrentID 
    )
VAR AccumulatedSaving = SUMX ( TableOnAndBefore, 'Table'[New Savinng] )
RETURN
    IF ( 
        HASONEVALUE ( 'Table'[ID] ),
        StartingValue - AccumulatedSaving
    )

@tamerj1    it worked perfectly -   thanks a lot 

tamerj1
Super User
Super User

@neees78 
Is new Saving a measure or a column? Are all columns coming from the same table?

Yes - all columns in single table , the "New Saving" is a column

@neees78 
Is new Saving a measure or a column?

the new saving is column - I just added it to explain - starts at 100K then it should reduce 

FreemanZ
Super User
Super User

hi @neees78 

do you have other columns in the dataset?

yes - Title (txt) & ID (Number) 

 

neees78_0-1676633586059.png

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.