Beast Mode to change value in Column A based on Value in Column B

Hi there!

I have a table that includes a Site ID column and a Site Name Column. I want to change the Site Name when the Site ID = x. I have the following code which works but it creates a new column but I don't want a new column, instead I want to change the Site Name in the existing site name column. Many thx in advance!

Chris

 

CASE when `Site ID` = x AND `Site Name` = 'OLD NAME'
then 'NEW NAME'
else `Site Name`
end

Best Answer

  • ST_-Superman-_
    Answer ✓

    You just need to filter your list first.

     

    I created a basic dataset to try to mimic this for you here:17774 1.png

     

     

    In this case, I have two Site IDs that have the same customer name, "Clark Kent".  The first step is to create two filters.  One that contains the data that you don't want to change, and one that has everything you want changed...Don't ChangeDon't Change

     

    Data to ChangeData to Change

     

    Then, you use replace text to make your change:17774 4.png

     

     

    Next, you append the two tables:17774 5.png

     

    17774 6.png

     

    Now, any combination of site b and Clark Kent has been changed to site b and Superman


    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman

Answers

  • If you don't want to create a new column, you would need to do this in the ETL. You can use the Replace Text function to replace a site name with a different site name and not add it as a new column

    **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.
  • Thanks for your response!
    I couldn't find a way to do this with an ETL because I have several customers with the same name but different site ID. I only want to change the name when both the site ID and name matches what I'm looking for. I can do this in both an ETL and a Beast mode but only by adding a new column.
    Thx again!

  • ST_-Superman-_
    Answer ✓

    You just need to filter your list first.

     

    I created a basic dataset to try to mimic this for you here:17774 1.png

     

     

    In this case, I have two Site IDs that have the same customer name, "Clark Kent".  The first step is to create two filters.  One that contains the data that you don't want to change, and one that has everything you want changed...Don't ChangeDon't Change

     

    Data to ChangeData to Change

     

    Then, you use replace text to make your change:17774 4.png

     

     

    Next, you append the two tables:17774 5.png

     

    17774 6.png

     

    Now, any combination of site b and Clark Kent has been changed to site b and Superman


    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
  • That's awesome! Thanks Superman!