Forum Discussion

Progressive's avatar
Progressive
Regular Visitor
8 years ago
Solved

Combine and SUM multiple columns

Hi,

 

I created dashbord table and I would like to combine the column1 with commas and SUM the column2 based on column3. Is it possible?

 

I have a table like this,

Column1,Column2,Column3

A5XX
B10XX
C12XX
D3YY
F8YY
G15ZZ
Y4SS
H1BB

 

Final result should be like below

Column1,Column2,Column3

A,B,C27 (5+10+12)XX
D,F11(3+8)YY
G15ZZ
Y4SS
H1BB

 

Thanks in advance.

  • Create a meausre like this:

     

    Measure = CONCATENATEX(VALUES('Table'[Column1]),[Column1],",") 

    Create a table visualization with Column 3, Column 2 with default SUM and this measure.

     

     

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Create a meausre like this:

     

    Measure = CONCATENATEX(VALUES('Table'[Column1]),[Column1],",") 

    Create a table visualization with Column 3, Column 2 with default SUM and this measure.

     

     

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi Progressive,

     

    Alternatively, you could new a calculated table with this formula:

    New Table =
    SUMMARIZE (
        Table,
        Table[Column3],
        "Column1", CONCATENATEX ( Table, Table[Column1], "," ),
        "Column2", SUM ( Table[Column2] )
    )

     

    Best regards,

    Yuliana Gu

    • Progressive's avatar
      Progressive
      Regular Visitor

      Hi v-yulgu-msft,

      I tried your formula and it works with one downside. Now, I have duplicates in Column1. Like A,B,C,A,A,A,A

      Is there anyway to remove dubs in Column1. Something like DISTINCT SUMMARIZE :)