Forum Discussion
JankoC
4 years agoRegular Visitor
Get differerence of sums between all dates in table
Hello! So I have this table (raw and image of only the first two rows below) from which I created a new table which contains sum of "SteviloSporocil" column for each "Zdravstveni dom" grouped by dat...
- 4 years ago
Hi JankoC ,
Maybe you can try this code:
Measure = VAR _first = CALCULATE ( MIN ( 'Table'[Datum] ), ALLSELECTED ( 'Table'[Datum] ) ) VAR _diff = SUM ( 'Table'[Vsota sporočil] ) - CALCULATE ( SUM ( 'Table'[Vsota sporočil] ), PREVIOUSDAY ( 'Table'[Datum] ) ) RETURN IF ( SELECTEDVALUE ( 'Table'[Datum] ) = _first, CALCULATE ( SUM ( 'Table'[Vsota sporočil] ), FILTER ( ALLSELECTED ( 'Table'[Datum] ), [Datum] = _first ) ), _diff )Result:
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-chenwuz-msft
Community Support
4 years agoHi JankoC ,
Maybe you can try this code:
Measure =
VAR _first =
CALCULATE ( MIN ( 'Table'[Datum] ), ALLSELECTED ( 'Table'[Datum] ) )
VAR _diff =
SUM ( 'Table'[Vsota sporočil] )
- CALCULATE ( SUM ( 'Table'[Vsota sporočil] ), PREVIOUSDAY ( 'Table'[Datum] ) )
RETURN
IF (
SELECTEDVALUE ( 'Table'[Datum] ) = _first,
CALCULATE (
SUM ( 'Table'[Vsota sporočil] ),
FILTER ( ALLSELECTED ( 'Table'[Datum] ), [Datum] = _first )
),
_diff
)
Result:
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.