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
GeekAlfPro
Resolver II
Resolver II

Pivot Question and group by

Hello,

 

i'm facing an issue and don't know how to resolve it.

i have datas like this : 

 

GeekAlfPro_0-1611313280647.png

and i want to transform like this, where the _6 column have only one row

 

GeekAlfPro_1-1611313314400.png

i tried several things (pivot fill up and so on), but without success

 

any help would be welcome !

1 ACCEPTED SOLUTION
Anonymous
Not applicable

let
    Origine = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dY6xDoAgDET/pbMLtKXyLcQBEzed9P9jDwZigstB8njclUKBFgrJY6/3gbsg1GhbCsUpFG5QdE7zoJEz/r/q2WrMQzpNU9cGdFW7ihErTO3UpmrutfozygblwOxHfbAJL00+0BpEa4SbXd1e", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id = _t, poste = _t, libelle = _t, nombre = _t, taux = _t]),
    #"Raggruppate righe" = Table.Group(Origine, {"id"}, {{"all", each Table.First(_)},{"sal", each Record.FromList(List.Skip(_[taux]), List.Skip(_[poste]))}}),
    #"Tabella all espansa1" = Table.ExpandRecordColumn(#"Raggruppate righe", "all", {"poste", "libelle", "nombre"}, {"poste", "libelle", "nombre"}),
    #"Tabella sal espansa" = Table.ExpandRecordColumn(#"Tabella all espansa1", "sal", {"2391", "2395", "3133", "3137"}, {"2391", "2395", "3133", "3137"})
in
    #"Tabella sal espansa"

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

let
    Origine = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dY6xDoAgDET/pbMLtKXyLcQBEzed9P9jDwZigstB8njclUKBFgrJY6/3gbsg1GhbCsUpFG5QdE7zoJEz/r/q2WrMQzpNU9cGdFW7ihErTO3UpmrutfozygblwOxHfbAJL00+0BpEa4SbXd1e", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id = _t, poste = _t, libelle = _t, nombre = _t, taux = _t]),
    #"Raggruppate righe" = Table.Group(Origine, {"id"}, {{"all", each Table.First(_)},{"sal", each Record.FromList(List.Skip(_[taux]), List.Skip(_[poste]))}}),
    #"Tabella all espansa1" = Table.ExpandRecordColumn(#"Raggruppate righe", "all", {"poste", "libelle", "nombre"}, {"poste", "libelle", "nombre"}),
    #"Tabella sal espansa" = Table.ExpandRecordColumn(#"Tabella all espansa1", "sal", {"2391", "2395", "3133", "3137"}, {"2391", "2395", "3133", "3137"})
in
    #"Tabella sal espansa"

Hello @Anonymous 

 

thank you very much that's exactly what i tried to do.

have a good day

Anonymous
Not applicable

help who can help you: upload a table that can be easily copied!

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.

Top Solution Authors
Top Kudoed Authors