How do I use data in one column to replace data in a different column in Beast Mode?

Options

I need to create a new column that pulls data in from one column but changes only certain cells to another value based on a value in the same row from a different column.

This is what I have tried:

CASE WHEN 'column A' = "xyz" THEN 'column B' 'abc' ELSE 'column B' END

CASE WHEN 'column A' = "xyz" THEN 'column B'='abc' ELSE 'column B' END

CASE WHEN 'column A' = "xyz" THEN 'column B' ,'abc' ELSE 'column B' END

CASE WHEN 'column A' = "xyz" THEN 'column B' 'abc' END

CASE WHEN 'column A' = "xyz" THEN 'column B', 'abc' END

CASE WHEN 'column A' = "xyz" THEN 'column B'='abc' END

I keep getting a syntax error message. How can I fix this please?

Best Answer

  • MarkSnodgrass
    Answer ✓
    Options

    Your syntax needs to be like this:

    CASE WHEN column A = 'xyz' THEN 'abc' ELSE column B END
    

    When referencing the columns in your dataset, make use of the autocomplete when starting to type out your column so that you know it is being referenced properly. When comparing it to a string, put single quotes around the string. Column names will have a backtick around them and will be colored differently than string values.

    This resulting beast mode should be used in place of column B in your chart/table.

    Hope this helps.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.

Answers

  • MarkSnodgrass
    Answer ✓
    Options

    Your syntax needs to be like this:

    CASE WHEN column A = 'xyz' THEN 'abc' ELSE column B END
    

    When referencing the columns in your dataset, make use of the autocomplete when starting to type out your column so that you know it is being referenced properly. When comparing it to a string, put single quotes around the string. Column names will have a backtick around them and will be colored differently than string values.

    This resulting beast mode should be used in place of column B in your chart/table.

    Hope this helps.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • DJV
    Options

    Hi Mark- thank you for the answer. This worked thank you!!!