Forum Discussion
Calculate Value Change / Value Difference between given Dates
- Anonymous4 years ago
Hi nexaframe ,
Please refer to my pbix file to see if it helps you.
Create a table.
Table 2 = VALUES('Table'[ReportDate])Then put the table 2 [reportdate] into the column filed.
Create two measures.
Measure = VAR _oreplrblank = CALCULATE ( MAX ( 'Table'[Value] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Type] IN VALUES ( 'Table'[Type] ) && 'Table'[ReportDate] IN VALUES ( 'Table 2'[ReportDate] ) ) ) VAR _harereplace = IF ( _oreplrblank = BLANK (), 0, _oreplrblank ) RETURN _harereplaceMeasure_2 = VAR _DATEBEFORE = CALCULATE ( MAX ( 'Table 2'[ReportDate] ), FILTER ( ALL ( 'Table 2' ), 'Table 2'[ReportDate] < MAX ( 'Table 2'[ReportDate] ) ) ) VAR _VALUEBEFORE = CALCULATE ( [Measure], FILTER ( ALL ( 'Table 2' ), 'Table 2'[ReportDate] = _DATEBEFORE ) ) RETURN [Measure] - _VALUEBEFOREBest Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi nexaframe ,
Please refer to my pbix file to see if it helps you.
Create a table.
Table 2 = VALUES('Table'[ReportDate])
Then put the table 2 [reportdate] into the column filed.
Create two measures.
Measure =
VAR _oreplrblank =
CALCULATE (
MAX ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Type]
IN VALUES ( 'Table'[Type] )
&& 'Table'[ReportDate] IN VALUES ( 'Table 2'[ReportDate] )
)
)
VAR _harereplace =
IF ( _oreplrblank = BLANK (), 0, _oreplrblank )
RETURN
_harereplace
Measure_2 =
VAR _DATEBEFORE =
CALCULATE (
MAX ( 'Table 2'[ReportDate] ),
FILTER (
ALL ( 'Table 2' ),
'Table 2'[ReportDate] < MAX ( 'Table 2'[ReportDate] )
)
)
VAR _VALUEBEFORE =
CALCULATE (
[Measure],
FILTER ( ALL ( 'Table 2' ), 'Table 2'[ReportDate] = _DATEBEFORE )
)
RETURN
[Measure] - _VALUEBEFORE
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- nexaframe4 years agoFrequent Visitor
Hello Anonymous
Thanks for your support.
Somehow it works in your attached file, but when I copy the exact same solution to the test data, it doesn't?
Unfortunately I can not upload the file here?
Also seeing your solution: The "total" calculation is not working by type and also not by date?
Any help is really appreciated.
Thank you!