Forum Discussion

JorgePereira's avatar
JorgePereira
Icon for Helper I rankHelper I
6 years ago
Solved

Resumir con texto

Hola a todos,

Tengo la tabla de abajo

ProductoCantidadTienda
Tomate10A
Zanahoria5A
Cebolla8A
Pepino12A
Tomate8B
Zanahoria2B
Zanahoria15C
Cebolla13C

y necesito la mesa final usando "Resumir"

¿Puedes ayudarme a unirme a las tiendas como en la siguiente tabla?

ProductoCantidadTienda
Tomate18A-B
Zanahoria22A-B-C
Cebolla21A-C
Pepino12A
  • ¿Ha intentado utilizar el comando CONCATENATEX DAX? ¿Qué tal esto? (Lo sentimos, reemplace "," por "-")

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

    fhill_0-1598474452597.png

2 Replies

  • camargos88's avatar
    camargos88
    Icon for Community Champion rankCommunity Champion

    Hola @JorgePereira ,

    Pruebe este 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"

    Capture.PNG

  • fhill's avatar
    fhill
    Icon for Resident Rockstar rankResident Rockstar

    ¿Ha intentado utilizar el comando CONCATENATEX DAX? ¿Qué tal esto? (Lo sentimos, reemplace "," por "-")

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

    fhill_0-1598474452597.png