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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
rmeng
Helper II
Helper II

Fill up groups of values

Is it possible with power query to transform table 1 into table 2? Can you help me.

rmeng_0-1614511900402.png

 

1 ACCEPTED SOLUTION
Jimmy801
Community Champion
Community Champion

Hello @rmeng 

 

this requires some Table.ToColumns, some transformation of the list created and then Table.FromColumns. What I cannot see from your data if on some point the number changes, what would lead then in repeating my transformation of tables to multiple entities. In this case you would need to group your data and apply my solution as function to it. Here the solution to the data provided by you

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUQKiCAgFRbE6cAmEXASmDC4dyJpw6EBIOOIyywmXhDOGRCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Numero = _t, A = _t, B = _t, C = _t, D = _t, E = _t, F = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Numero", Int64.Type}, {"A", type text}, {"B", type text}, {"C", type text}, {"D", type text}, {"E", type text}, {"F", type text}}),
    ToColumns = Table.ToColumns(#"Changed Type"),
    MaxLenghtOfColumn = List.Max(List.Transform(List.RemoveFirstN(ToColumns), each List.Count(List.Select(_, each _ <>"")) )),
    TransformColumnDeleteEmpty = List.Transform
    (
        ToColumns,
        each List.FirstN(List.Select(_,each _ <>""), MaxLenghtOfColumn)
    ),
    
    FromColumns = Table.FromColumns
    (
        TransformColumnDeleteEmpty,
        Table.ColumnNames(#"Changed Type")
    )
in
    FromColumns

this transforms this

Jimmy801_0-1614528510740.png

 

into this

Jimmy801_1-1614528524648.png

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

3 REPLIES 3
Jimmy801
Community Champion
Community Champion

Hello @rmeng 

 

this requires some Table.ToColumns, some transformation of the list created and then Table.FromColumns. What I cannot see from your data if on some point the number changes, what would lead then in repeating my transformation of tables to multiple entities. In this case you would need to group your data and apply my solution as function to it. Here the solution to the data provided by you

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUQKiCAgFRbE6cAmEXASmDC4dyJpw6EBIOOIyywmXhDOGRCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Numero = _t, A = _t, B = _t, C = _t, D = _t, E = _t, F = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Numero", Int64.Type}, {"A", type text}, {"B", type text}, {"C", type text}, {"D", type text}, {"E", type text}, {"F", type text}}),
    ToColumns = Table.ToColumns(#"Changed Type"),
    MaxLenghtOfColumn = List.Max(List.Transform(List.RemoveFirstN(ToColumns), each List.Count(List.Select(_, each _ <>"")) )),
    TransformColumnDeleteEmpty = List.Transform
    (
        ToColumns,
        each List.FirstN(List.Select(_,each _ <>""), MaxLenghtOfColumn)
    ),
    
    FromColumns = Table.FromColumns
    (
        TransformColumnDeleteEmpty,
        Table.ColumnNames(#"Changed Type")
    )
in
    FromColumns

this transforms this

Jimmy801_0-1614528510740.png

 

into this

Jimmy801_1-1614528524648.png

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Greg_Deckler
Community Champion
Community Champion

@rmeng Would be a piece of cake if you had each row labeled with A, B, C. Then you could just group. What is the logic behind how these things group together?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hello,

A, B , C are random text inside a cell. There´s no rules there, As you told I´ll try to do a Group BY?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors