Forum Discussion

JorgePereira's avatar
JorgePereira
Helper I
5 years ago
Solved

Summarize with text

Hello everyone,

I have the table below

ProductAmountStore
Tomato10A
Carrot5A
Onion8A
Cucumber12A
Tomato8B
Carrot2B
Carrot15C
Onion13C

and I need the final table using "Summarize"

Can you help me how to join the stores as in the table below?

ProductAmountStore
Tomato18A-B
Carrot22A-B-C
Onion21A-C
Cucumber12A
  • Have you tried using the CONCATENATEX DAX command? How about this? (Sorry, replace "," with "-")

    Medida: CONCATENATEX (Vegs, Vegs [Store], ",")

    fhill_0-1598474452597.png

2 Replies

  • fhill's avatar
    fhill
    Resident Rockstar

    Have you tried using the CONCATENATEX DAX command? How about this? (Sorry, replace "," with "-")

    Medida: CONCATENATEX (Vegs, Vegs [Store], ",")

    fhill_0-1598474452597.png

  • camargos88's avatar
    camargos88
    Community Champion

    Hi JorgePereira ,

     

    Try this mcode:

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCsnPTSzJV9JRMjQAEo5KsTrRSs6JRUX5JUCuKVzIPy8zPw/Is0AoKk0uzU1KLQJpNYKLwo0DKXRCNc0IU8gQZIMzig2GxhChWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, Amount = _t, Store = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Product", type text}, {"Amount", Int64.Type}, {"Store", type text}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"Product"}, {
                                    {"Amount", each List.Sum([Amount]), type nullable number},
                                    {"Store", each Text.Combine([Store], "-"), type text}
                                }
                                
                                )
    in
        #"Grouped Rows"