user3581800
user3581800

Reputation: 317

Make classifications with number ranges on Tableau

I Have a deposits parameter. I want to classify population into 3 sections as follows: high, medium and low

Tried to create a calculated field.This does not work for me in the following way and gives different errors. Please advise?

if 1300<[deposit] then 'high' or
if 1150<[deposit]< 1300 then 'Medium'
 else 'Low' 
 END
 END

Upvotes: 0

Views: 219

Answers (1)

matt_black
matt_black

Reputation: 1330

You can't have multiple logic comparisons in a single if statement and you need to pay attention to the actual syntax of the if statement. Multiple statements can be combined with elseif but not by or.

So, assuming that [deposit] is an integer you could write:

if [deposit]>1300 then "high"
elseif [deposit]>1150 then "medium"
else "low"
end

Tableau makes the key information on function syntax available just to the right of the function edit box (click the little right triangle if it doesn't appear automatically) so this information isn't hard to find.

Upvotes: 1

Related Questions