Forum Discussion
The sameperoidlastyear function calculates the value for its year and not the previous year
- Anonymous2 years ago
Hi Anonymous
Thanks for the reply from Greg_Deckler and HotChilli .
Anonymous , the following test is for your reference.
My sample:
Create several measures as follow
This year = SUM('Table'[Value])The measure was created just to restore your scenario, as I don't know the creation logic of your Wolumen.
Measure = VAR _year = MAX([Year]) VAR _month = MAX([Month]) RETURN CALCULATE([This year], FILTER(ALL('Table'), [Year] = _year - 1 && [Month] = _month))Measure 1 = SUMX(VALUES('Table'[Month]), [Measure])Last year = SUMX(VALUES('Table'[Year]), [Measure 1])Output:
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 Anonymous
Thanks for the reply from Greg_Deckler and HotChilli .
Anonymous , the following test is for your reference.
My sample:
Create several measures as follow
This year = SUM('Table'[Value])
The measure was created just to restore your scenario, as I don't know the creation logic of your Wolumen.
Measure =
VAR _year = MAX([Year])
VAR _month = MAX([Month])
RETURN
CALCULATE([This year], FILTER(ALL('Table'), [Year] = _year - 1 && [Month] = _month))
Measure 1 = SUMX(VALUES('Table'[Month]), [Measure])
Last year = SUMX(VALUES('Table'[Year]), [Measure 1])
Output:
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.