Beast Mode

Beast Mode

Getting syntax error to calculate MOM change

Can anyone help me what syntax error is there in this beast mode calculation?

CASE
WHEN LAG(Weighted Average, 1) OVER (ORDER BY Sort: Month Number) IS NOT NULL THEN
(Weighted Average - LAG(Weighted Average, 1) OVER (ORDER BY Sort: Month Number))
/
NULLIF(LAG(Weighted Average, 1) OVER (ORDER BY Sort: Month Number), 0)
ELSE
NULL
END

Tagged:

Best Answer

  • Contributor
    Answer ✓

    Hello @agolla2 ,

    I believe the issue is with your order by clause. I would expect it to be (ORDER BY Month Number).

    (ORDER BY Month Number ASC) for ascending or (ORDER BY Month Number DESC) for descending.

    Chris

Answers

  • Contributor
    Answer ✓

    Hello @agolla2 ,

    I believe the issue is with your order by clause. I would expect it to be (ORDER BY Month Number).

    (ORDER BY Month Number ASC) for ascending or (ORDER BY Month Number DESC) for descending.

    Chris

Welcome!

It looks like you're new here. Members get access to exclusive content, events, rewards, and more. Sign in or register to get started.
Sign In