Forum Discussion

JoeyF's avatar
JoeyF
Frequent Visitor
2 years ago
Solved

Nested IF OR Statement when creating a New Custom Column

I am trying to create a new Custom Column which is creating a new Category Name based on the text contained in the CATNAME column.  Basically I want the Category Name to be "Roads" if the CATNAME co...
  • kpost's avatar
    2 years ago

    Well, I'm much more familiar with DAX than Power Query. 

     

    So here's how I'd do it as a calculated column.  But don't let this deter you from trying it your way, just throwing in one viable solution.

     

    Custom Column = 
    VAR catname = [CATNAME]
    RETURN
    SWITCH(
            TRUE(),
             CONTAINSSTRING(catname, "SIGN") || CONTAINSSTRING(catname, "KERB") || CONTAINSSTRING(catname, "PATH") || CONTAINSSTRING(catname, "ROAD"), "Roads",

             CONTAINSSTRING(catname, "DRAIN"), "Drainage",
             catname

    )

     

    Hopefully you can get some help with your column in Power Query, but if not this will work for you.