Forum Discussion

pagliaci's avatar
pagliaci
Frequent Visitor
4 years ago
Solved

Create column with the group for multiple values

Hello, I have a Table with a column called "Names" with a lot of versions of 2 products for example "barbie" and "cars". I need to create a new column "Groups" that show me only the major groups, but I have 1000+ items in my column to do one by one.. 

 

Does anyone have an ideia how I could do this? My result should be something like: 

 

 

 

  •  

    column = switch(true(),CONTAINSSTRING('tbl'[Names],"Barbie")=TRUE(),"Barbie","Cars")

    pagliaci 

     

3 Replies

  • smpa01's avatar
    smpa01
    Community Champion

     

    column = switch(true(),CONTAINSSTRING('tbl'[Names],"Barbie")=TRUE(),"Barbie","Cars")

    pagliaci 

     

    • pagliaci's avatar
      pagliaci
      Frequent Visitor

      What if I have more than 1 option, I wanted to say if glow OR beach than write Barbie. How do I make this OR?

      I am trying || : 

      column = switch(true(),CONTAINSSTRING('Versões - SAP'[Versões],"CONCENTRADO" || "CONCENT")=TRUE(),"CONCENTRADO")
       
      but it gives me the error Cannot convert value 'CONCENTRADO' of type Text to type True/False.
      • smpa01's avatar
        smpa01
        Community Champion

        pagliaci 

         

        column = switch(true(),CONTAINSSTRING('tbl'[Names],"Barbie")=TRUE()||CONTAINSSTRING('tbl'[Names],"Glow")=TRUE(),"Barbie","Cars")