Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

this week versus last week difference

I have a table below in which i wanted to calculate or get the difference from this week's count against last week. below is a sample table output that i wanted to achieve. i wanted to get a dax form...
  • v-easonf-msft's avatar
    4 years ago

    Hi, Anonymous 

    Please try formula like:

    Week Difference = 
    VAR last_week =
        CALCULATE (
            MAX ( 'Table'[WEEKENDINGSAT] ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[WEEKENDINGSAT] < MAX ( 'Table'[WEEKENDINGSAT] )
            )
        )
    VAR _count_of_lastweek =
        CALCULATE (
            [CountOfECMs1],
            FILTER ( ALL ( 'Table' ), 'Table'[WEEKENDINGSAT] = last_week )
        )
    RETURN
        IF (
            ISBLANK ( _count_of_lastweek ),
            BLANK (),
            [CountOfECMs1] - _count_of_lastweek
        )

    Best Regards,
    Community Support Team _ Eason