Forum Discussion

CH_MJR79's avatar
CH_MJR79
Helper II
3 years ago
Solved

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...
  • v-yanjiang-msft's avatar
    v-yanjiang-msft
    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 _ kalyj

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.