Forum Discussion
Last Year compared to Current YTD
- 9 years ago
Hi alison_mergaman,
Based on my tests, the formula below should work in your scenario. :smileyhappy:
Exams LY = VAR maxDate = LASTDATE ( v_Master_Item_Detail[TransactionDate] ) VAR minDate = FIRSTDATE ( v_Master_Item_Detail[TransactionDate] ) RETURN CALCULATE ( [Exams], FILTER ( ALL ( v_Master_Item_Detail ), v_Master_Item_Detail[TransactionDate] <= DATEADD ( maxDate, -1, YEAR ) && v_Master_Item_Detail[TransactionDate] >= DATEADD ( minDate, -1, YEAR ) ) )Regards
Hi alison_mergaman,
Based on my tests, the formula below should work in your scenario. :smileyhappy:
Exams LY =
VAR maxDate =
LASTDATE ( v_Master_Item_Detail[TransactionDate] )
VAR minDate =
FIRSTDATE ( v_Master_Item_Detail[TransactionDate] )
RETURN
CALCULATE (
[Exams],
FILTER (
ALL ( v_Master_Item_Detail ),
v_Master_Item_Detail[TransactionDate] <= DATEADD ( maxDate, -1, YEAR )
&& v_Master_Item_Detail[TransactionDate] >= DATEADD ( minDate, -1, YEAR )
)
)
Regards
v-ljerr-msft First I want to thank you so much for all of your efforts! But sadly, this equation does not work for me either. I took a screen shot showing from Feb 2016- April 2017 comparing that years monthly data, the last year data I originally created and the one you just created. This time your last year data numbers changed slightly. You can tell those numbers are wrong when looking at the second column and and seeing the number in Exams Only LY.
So here March 2016: 20,416 and March 2017's LY: 20416 but your March 2017's LY: 20756. I know this is incredibly weird. Thank you again for al of your effort to helping me solve this issue!