Forum Discussion

Stroop's avatar
Stroop
Frequent Visitor
9 years ago
Solved

Year On year comparisons

Hi   I have a table showing bookings for each month this year and last year.   I have a second table showing YOY differences where the YOY difference is calculated by   YoY_diff = VAR CurrentD...
  • v-ljerr-msft's avatar
    9 years ago

    Hi Stroop,

     

    According to your description above, using DIVIDE function in your formula like below should work in this scenario. :smileyhappy:

    YoY_diff =
    VAR CurrentDate =
        MAX ( 'exptemp fullyon'[date] )
    VAR lastyear =
        CALCULATE (
            'data1'[Sum_Bookings],
            'exptemp fullyon'[foyear]
                = YEAR ( CurrentDate ) - 1
        )
    VAR thisyear =
        CALCULATE (
            'data1'[Sum_Bookings],
            'exptemp fullyon'[foyear] = YEAR ( CurrentDate )
        )
    RETURN
        DIVIDE ( thisyear - lastyear, lastyear )

     

    Regards