Forum Discussion

RenataOGardner's avatar
6 years ago
Solved

New column

Hello guys,

 

I'm trying to create a column where a list of customer numbers is related to the customer name, but I can't add more than 3 argument for the function below. All the numbers below should give "John Lewis" as answer. Can anyone help me out? Cheers!

  • HotChilli's avatar
    HotChilli
    6 years ago

    The syntax is wrong.   Replace that = with a ,

    And check that the data type of [no_] is text.  If it is of number type then you don't need the quotes round the hardcoded values

6 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    You could use nested IF statements, but don't. Use SWITCH instead but I can't exactly tell what you are trying to do. 

    • RenataOGardner's avatar
      RenataOGardner
      Helper II

      Hi,

       

      What I'm trying to do is: Create a column with the name of the Custormer and add all the locations that are under this customer. The locations are coded by number so each number I want to call for the name of the customer. 

       

      Thanks!

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        So something like:

         

        Column =

          SWITCH('Table'[Column],

            "39062","John Lewis",

            "39063","John Lewis",

            <as many pairs as you want>

          )