Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Lista de teléfonos a tabla agrupada Query/Dax

Buenas!! 

No tengo mucho tiempo de Power Bi y me falta para comprender el Lenguaje M de Query (o codigo Dax), por lo que, necesito ayuda con lo siguiente..
Tengo la siguiente lista de telefonos con la prioridad de uso,segun otra caracteristica, y su codigo, referido a un cliente.

discadortel.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

Lo que busco es una tabla como la siguiente, en power bi, que permita agrupar los codigos de clientes y todos sus telefonos asociados queden en las sucesivas columnas

Capturatab.JPG

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

No hay @Syndicate_Admin

¿Necesitas ordenar los telefonos en orden? Péguelo en el Editor avanzado, puede eliminar los alelos si no necesita nada.

Vera_33_2-1616043404042.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bc+xDQAhDAPAXVJTBJKQzyyI/dd4QIqel1y4ObmwxyBVMTOnQnUl2GiW1AdqIO0MdYturbe27P5UoCpUS11rPu1QHWp+k2iXBlJnqEdS5ws=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [telefonos = _t, prioridad = _t, codigo = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"telefonos", type text}, {"prioridad", Int64.Type}, {"codigo", Int64.Type}}),
    #"Sorted Rows" = Table.Sort(#"Changed Type",{{"prioridad", Order.Ascending}}),
    #"Grouped Rows" = Table.Group(#"Sorted Rows", {"codigo"}, {{"allrows", each _, type table [telefonos=nullable text, prioridad=nullable number, codigo=nullable number]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "telefonos", each Text.Combine( [allrows][telefonos],";")),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Added Custom", "telefonos", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"telefonos.1", "telefonos.2", "telefonos.3", "telefonos.4"})
in
    #"Split Column by Delimiter"

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

No hay @Syndicate_Admin

¿Necesitas ordenar los telefonos en orden? Péguelo en el Editor avanzado, puede eliminar los alelos si no necesita nada.

Vera_33_2-1616043404042.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bc+xDQAhDAPAXVJTBJKQzyyI/dd4QIqel1y4ObmwxyBVMTOnQnUl2GiW1AdqIO0MdYturbe27P5UoCpUS11rPu1QHWp+k2iXBlJnqEdS5ws=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [telefonos = _t, prioridad = _t, codigo = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"telefonos", type text}, {"prioridad", Int64.Type}, {"codigo", Int64.Type}}),
    #"Sorted Rows" = Table.Sort(#"Changed Type",{{"prioridad", Order.Ascending}}),
    #"Grouped Rows" = Table.Group(#"Sorted Rows", {"codigo"}, {{"allrows", each _, type table [telefonos=nullable text, prioridad=nullable number, codigo=nullable number]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "telefonos", each Text.Combine( [allrows][telefonos],";")),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Added Custom", "telefonos", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"telefonos.1", "telefonos.2", "telefonos.3", "telefonos.4"})
in
    #"Split Column by Delimiter"

Thanks!! yout contribution was a great help to me!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.