Forum Discussion

ivanuska's avatar
ivanuska
Advocate I
5 years ago
Solved

Merging data in one column as per unique column in same table

Hi guys,

 

I am new to Power BI and would need your help. I've got the example of dataset and would need to merge the lines in "Country" column as per unique values and concatenate inputs in "City" column separated by comma - perhaps using Measure (as Calculated column would create duplicate entries). Please find below details:

 

Existing dataset:

 

Result should be:

     

CountryCity
FranceParis
USANew York, Chicago, Minesota
GermanyBerlin
ItalyRome

     

Thank you for any suggestion!

 

 

  • ivanuska's avatar
    ivanuska
    5 years ago

    I have managed to resolve this by adding ", " at the end of your function:

     

    New table = summarize('Table', 'Table'[Country], "City",concatenatex('Table', 'Table'[City], ", "))
     

     

     
    Thank you for help!

3 Replies

  • ivanuska , You can use this measure in the display table

    concatenatex(Table, Table[City])

     

    New table = summarize(Table, Table[Country], "City",concatenatex(Table, Table[City]))

    • ivanuska's avatar
      ivanuska
      Advocate I

      Now it is merging without comma e.g. "New YorkChicagoMinesota" - can you please advise how to separate those values with comma?

    • ivanuska's avatar
      ivanuska
      Advocate I

      I have managed to resolve this by adding ", " at the end of your function:

       

      New table = summarize('Table', 'Table'[Country], "City",concatenatex('Table', 'Table'[City], ", "))
       

       

       
      Thank you for help!