doing case when like statements in datameer?

Comments

5 comments

  • Frances Angulo

    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.

    1
    Comment actions Permalink
  • Ronak Patel2

    Thanks!...what about using wildcards with them?

    0
    Comment actions Permalink
  • Frances Angulo

    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.

    0
    Comment actions Permalink
  • Chad Hult

    Frances Angulo are you mixing data types in the statement?  90 integer, "A" string.

    From what I have seen this won't work???  Or have did you get mixed data types working somehow?

    IF(#Sheet!Column>90;"A";IF(#Sheet!Column<20;"F"; "Average"))

    Curious.  Thanks

    0
    Comment actions Permalink
  • Joel Stewart

    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! 

     

    0
    Comment actions Permalink

Please sign in to leave a comment.