1 of 1 people found this helpful
Yes, you can use and IF THEN ELSEIF statement.
Middle of the page...
IF test1 THEN value1 ELSEIF test2 THEN value2 ELSE else END
There is no built-in limit to the number of ELSEIF test THEN value’s in an IF expression, however, individual databases may impose a limit on IF statement complexity. While an IF statement can be rewritten as a series of nested IIF statements, there are differences in how the expressions will be evaluated. In particular, an IIF statement distinguishes TRUE, FALSE and UNKNOWN, while an IF statement only worries about TRUE and not true (which includes both FALSE and UNKNOWN). For example,
IF [Region]=”West” THEN 1 ELSEIF [Region]=”East” THEN 2 ELSE 3 END
Hope this helps.
Thanks for the response Derek but in the issue stated above; the "if condition" check occurs always and not when prior condition fails for which i can go for ELSEIF .
I'm a bit confused as to the progression of IFs. This may not answer your question correctly on if you can have multiple IFs following each other, but do you have to do it like that?
Following your IF-"story", I think this is what you do:
Set X to the value of B
If A is bigger then X, set X to the value of A
If C is in a range return X otherwise...
if D is bigger then X set X the value of D
if E is bigger then X set X the value of E
So in that story, several IFs are following each other and may or may not do something to X. If you shuffle it around a bit, you can achieve the same with this:
If C is in a range...
return the biggest value of X, D and E (where X is the biggest of A and B)
return the biggest value of A and B
Which in Tableau Calculations could be something like this:
IF ([C] = "xxx" or [C] = "yyy")THEN
max( max( max([A],[B]) , [D]), [E])
Hope this helps
Thanks a lot for the response Dana, my mind was stuck thinking about IF's.Never went in direction of playing around with the conditions. Thanks much again.