Forum Discussion
neees78
Helper II
3 years agoCalculated 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
Hi neees78
Please refer to attached sample file with the proposed solution. Hope this is what you're looking forDaily 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 )
8 Replies
- tamerj1
Community Champion
Hi neees78
Please refer to attached sample file with the proposed solution. Hope this is what you're looking forDaily 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 ) - neees78
Helper II
yes - Title (txt) & ID (Number)