Forum Discussion
Year to date comparison
- Anonymous2 years ago
Hi NewbieJono
Thanks for the reply from Greg_Deckler , please allow me to provide another insight:
I created a sample to get the difference in Value for 01/04/2024 - 19/04/2024 and the difference in Value for 01/04/2023 - 19/04/2023, hope this helps.
My sample:
Create two measures as follow
01/04/2024 - today = VAR _1 = CALCULATE(SUM('Table'[Value]), FILTER('Table', [Date] = EOMONTH(TODAY(), -1) + 1)) VAR _2 = CALCULATE(SUM('Table'[Value]), FILTER('Table', [Date] = TODAY())) RETURN _1 - _201/04/2023 - 19/04/2023 = VAR _11 = DATE(YEAR(TODAY()) - 1, MONTH(TODAY()), DAY(TODAY())) VAR _1 = CALCULATE(SUM('Table'[Value]), FILTER('Table', [Date] = _11)) VAR _2 = CALCULATE(SUM('Table'[Value]), FILTER('Table', [Date] = EOMONTH(_11, -1) + 1)) RETURN _1 - _2Result:
If this sample data is structurally different from the one you are using, please do not hesitate to mention it and I will modify it.
Best Regards,
Yulia XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi NewbieJono
Thanks for the reply from Greg_Deckler , please allow me to provide another insight:
I created a sample to get the difference in Value for 01/04/2024 - 19/04/2024 and the difference in Value for 01/04/2023 - 19/04/2023, hope this helps.
My sample:
Create two measures as follow
01/04/2024 - today =
VAR _1 = CALCULATE(SUM('Table'[Value]), FILTER('Table', [Date] = EOMONTH(TODAY(), -1) + 1))
VAR _2 = CALCULATE(SUM('Table'[Value]), FILTER('Table', [Date] = TODAY()))
RETURN
_1 - _2
01/04/2023 - 19/04/2023 =
VAR _11 = DATE(YEAR(TODAY()) - 1, MONTH(TODAY()), DAY(TODAY()))
VAR _1 = CALCULATE(SUM('Table'[Value]), FILTER('Table', [Date] = _11))
VAR _2 = CALCULATE(SUM('Table'[Value]), FILTER('Table', [Date] = EOMONTH(_11, -1) + 1))
RETURN
_1 - _2
Result:
If this sample data is structurally different from the one you are using, please do not hesitate to mention it and I will modify it.
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.