Forum Discussion

tlwest86's avatar
tlwest86
Helper I
4 years ago
Solved

SWITH Command to Change Only One Value in a Column

I have a column with over 10,000 values, of which there are about 50 distinct values.  I want to perform a Switch command on just 1 value and leave the other 49 values the same as they current are.  Is there a way to add a command to the Switch to where it ignores all other values and leaves them the same as they are currently listed?  I do not want to write 49 other lines of code and new values could appear in the future once this report is deployed to service. 

 

Action Switch =
            SWITCH(
TRUE(),
                    CONTAINSSTRING('Table'[Column], "SOP"), "SOP"

                        )
  • You could create a new conditional column in Power Query along the lines of

    if Text.Contains([Column], "SOP") then "SOP" else [Column]

    and then delete the original column

2 Replies

  • You could create a new conditional column in Power Query along the lines of

    if Text.Contains([Column], "SOP") then "SOP" else [Column]

    and then delete the original column