Beast Mode YTD % Change YoY

Options

Hello,

 

I'm trying to provide YTD % change vs. prev. year but I can't seem to pull a value from this. Any help is appreciated!

 

(CASE WHEN TRIM(YEAR(`Date`))=YEAR(CURDATE()) then sum(`Online`)

else 0 End)

/

(CASE WHEN TRIM(YEAR(`Date`))=Year(ADDDATE(CURDATE(), interval -1 year)) then sum(`Online`)

else 0 End)

Comments

  • Valiant
    Options

    Made a couple small tweeks. Give this a shot:

    SUM(CASE WHEN YEAR(`Date`)=YEAR(CURDATE()) then `Online`
    else 0 End)
    /
    SUM(CASE WHEN YEAR(`Date`)=Year(ADDDATE(CURDATE(), interval -1 year)) then `Online`
    else 0 End)