Forum Discussion

melian's avatar
melian
Frequent Visitor
7 years ago
Solved

How to combine three columns into one?

Hi, 

 

I have a table that has three columns (Zip codes columns). I want to combine all of them into one column that has all the zip codes. How can I do that? 

13 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi melian

    Could you please post some sample data to replicate your issue???

     

     

    Regards,

    Angad

    • Anonymous's avatar
      Anonymous
      Not applicable

      CONCATENATE([col1],CONCATENATE([col2],[col3]))

      • melian's avatar
        melian
        Frequent Visitor

        Anonymous

        The problem with this is that it combines them on the same line, which is not what I want. Your code would make the the new list looks like this 

         

         

         

         

        However, I want the new list to look like this 

    • melian's avatar
      melian
      Frequent Visitor

       

      This is an example of what I want to do. In the table I am working on there are three columns, the first three, of zipcodes. I want to combine all of them into one column, All ZipCodes. 

      Anonymous

  • Hey!
    There's no build in function in Power BI for that, but you can use M/Power query. 

    (Source) =>
        let
            result = Table.FromList(List.Combine(Table.ToColumns(Source)), null, {"AllZipCodes"})
        in
            result

     Just google for how to apply Power Query to your Power BI. 
    However this function replaces all your columns. If you want to keept the old columns you got to customize the function. 

    Cheers Jakobob