Forum Discussion

phaering's avatar
phaering
Helper I
6 years ago
Solved

Create Column

How do I create a new column that uses a formula to generate a new value based on partial values from two other columns?  I was able to do this very easily in Tableau using a lengthy IF(CONTAINS)/THE...
  • Greg_Deckler's avatar
    6 years ago

    Well, that's frankly a horrible construction, doesn't Tableau have a SWITCH/CASE statement?

    Use a SWITCH(TRUE()...) statement. Replace CONTAINS with SEARCH or FIND like:

    Column?

    SWITCH(TRUE(),

    SEARCH("AIX 5.3",[OS],,-1 ) <> -1 THEN "AIX 5.3",

    SEARCH("AIX 6.1",[OS],,-1 ) <> -1 THEN "AIX 6.1",

    ...

    )