SQL in Tableau

I'm trying to break out all of the change %'s in product pricing into 7 different buckets (numbers 1-7) so that the coloring of my Tableau chart is a litte more defined. I keep getting an error in my calculated field stating that says "Expected 'END' to match 'IF' at character 144. Obviously I could just do this in my dataset, but figured this is basic enough of a calculation that I should know how to do it. Any help would be greatly appreciated. Here's the statement that's giving me the error message:

IF[% Change]<= -1
THEN 1
ELSEIF
[% Change]> -1 AND [% Change]<= -.05
THEN 2
ELSEIF
[% Change]> '-.05' AND [% Change]<= '0'
THEN 3
ELSE
IF[% Change]> 0 AND [% Change]<= .02
THEN 4
IF[% Change]> .02 AND [% Change]<= .05
THEN 5
ELSEIF
[% Change]> .05 AND [% Change]<= 2
THEN 6
ELSEIF
[% Change]> 2
THEN 7
END

I think you need an ELSE between these two lines

1 Like

Thanks. It looks like this fixed it, although I did notice a few other typos when I started going through it.