doing case when like statements in datameer?
How do you do case when like statements in datameer? Something like this:
case
when 1 then a
when 2 then b
when 3 then c
else d
end
-
You can create nested IF statements using syntax like:
IF(#Sheet!Column>90;"A";IF(#Sheet!Column<20;"F"; "Average"))
You can also use "IF(AND" combinations to define ranges. Operators mentioned here are 'greater than' and 'less than' but you can also use '=' and '=='. I believe this syntax also accepts pipes (||) for OR statements.
-
At first attempt, I didn't have success using a wild card in my formula. I think what might be appropriate, depending on your use case, would be to use something like REGEXTRACT or REGEX functions- which would give you the flexibility to pull certain results on conditions with that syntax.
-
In Frances's example, the data type for the #Sheet!Column is an Integer. That said, the statement #Sheet!Column>90 is a Boolean type which is required for the first parameter of the IF function. Continuing in the example, the output in all cases is a String (i.e. "A", "F", "Average"). As long as the output is all the same data type, the IF statement is valid.
Hopefully, that clears things up!
Please sign in to leave a comment.
Comments
5 comments