Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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
Solved! Go to Solution.
Hi @neees78
Please refer to attached sample file with the proposed solution. Hope this is what you're looking for
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
)
Hi @neees78
Please refer to attached sample file with the proposed solution. Hope this is what you're looking for
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
)
@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
the new saving is column - I just added it to explain - starts at 100K then it should reduce
yes - Title (txt) & ID (Number)
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
10 |
User | Count |
---|---|
19 | |
16 | |
15 | |
11 | |
9 |