Forum Discussion
CH_MJR79
3 years agoHelper II
Comparing data same period last year
Hi all, I have table that contains lines posted to a timesheet each day for certain categories. I've created a measure that calculates the total 'Actual Units' for the year to date, but I also n...
- 3 years ago
Hi CH_MJR79 ,
According to your description, I modify the formula:
SickDaysYTD_Pre = VAR _Pre = DATEADD ( 'SickDays'[Date], -12, MONTH ) VAR _PreToday = DATE ( YEAR ( TODAY () ) - 1, MONTH ( TODAY () ), DAY ( TODAY () ) ) RETURN CALCULATE ( SUM ( SickDays[Actual_Units] ), DATESYTD ( _Pre, "11-30" ), 'SickDays'[Date] <= _PreToday )Get the correct result in my sample.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
CH_MJR79
3 years agoHelper II
Many thanks v-yanjiang-msft. I actually ended up doing this in a slightly different way, by modifying my underlying SQL query to get the data for the period I needed. But will try out your suggestion above.