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 August 31st. Request your voucher.

Reply
Jay_Are
New Member

Reducing multiple lines to one new line in new chart with headlines from column

Hello community, 

first of all - I am bloody beginner and testing a few days with several sources...but the actual problem gets me really bad:

I have a table with one fulfilled column (a ID is listed multiple times) and behind it columns with labels/values not everytime filled.

Out of this I want to create a new "straight" table - as seen followed screens.

Jay_Are_0-1710250576192.png to this: 

Jay_Are_1-1710250601138.png

 

A few solutions were "near" it, but I might be too new to transfer it...I am happy on any input.

1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

Hi @Jay_Are, try this, but for future requests provide sample data as table so we can copy/paste and expected result (based on sample data)

 

Result

dufoq3_0-1710256277224.png

 

v1

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY+7CsJAEEX/ZesQ9qlpfRQ2imAZUoxmwYDZyD4E/Xp3o0QzSTNz4R6GOWVJmBBSKq5IRk4efHD/AS6+eZAqG2Fb8PqzQhs3ZTktck7pEoOHLg3bM1xIhftVXVvtXJ9SSFfX2t4ag8mjtq4z4+C1xdimC8anc+YF11sMXHwRpRacsVnHO7jBccBmHGV0jB0Cf45CFAVu5wx30J6DrTE6VdyDfWJqYpg+qt4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [result.id = _t, result.metadata.name = _t, result.metadata.label = _t, result.metadata.value = _t]),
    RemovedColumns = Table.RemoveColumns(Source,{"result.metadata.name"}),
    GroupedRows = Table.Group(RemovedColumns, {"result.id"}, {{"All", each Table.PromoteHeaders(Table.Transpose(Table.RemoveColumns(_, {"result.id"}, MissingField.Error))), type table}}),
    ExpandedAll = Table.ExpandTableColumn(GroupedRows, "All", List.Distinct(RemovedColumns[result.metadata.label]))
in
    ExpandedAll

 

 

v2

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY+7CsJAEEX/ZesQ9qlpfRQ2imAZUoxmwYDZyD4E/Xp3o0QzSTNz4R6GOWVJmBBSKq5IRk4efHD/AS6+eZAqG2Fb8PqzQhs3ZTktck7pEoOHLg3bM1xIhftVXVvtXJ9SSFfX2t4ag8mjtq4z4+C1xdimC8anc+YF11sMXHwRpRacsVnHO7jBccBmHGV0jB0Cf45CFAVu5wx30J6DrTE6VdyDfWJqYpg+qt4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [result.id = _t, result.metadata.name = _t, result.metadata.label = _t, result.metadata.value = _t]),
    RemovedColumns = Table.RemoveColumns(Source,{"result.metadata.name"}),
    PivotedColumn = Table.Pivot(RemovedColumns, List.Distinct(RemovedColumns[result.metadata.label]), "result.metadata.label", "result.metadata.value", each _),
    Transform = Table.TransformColumns(PivotedColumn, List.Transform(List.Distinct(RemovedColumns[result.metadata.label]), (colName)=> { colName, each _{0} }))
in
    Transform

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

3 REPLIES 3
dufoq3
Super User
Super User

Hi @Jay_Are, try this, but for future requests provide sample data as table so we can copy/paste and expected result (based on sample data)

 

Result

dufoq3_0-1710256277224.png

 

v1

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY+7CsJAEEX/ZesQ9qlpfRQ2imAZUoxmwYDZyD4E/Xp3o0QzSTNz4R6GOWVJmBBSKq5IRk4efHD/AS6+eZAqG2Fb8PqzQhs3ZTktck7pEoOHLg3bM1xIhftVXVvtXJ9SSFfX2t4ag8mjtq4z4+C1xdimC8anc+YF11sMXHwRpRacsVnHO7jBccBmHGV0jB0Cf45CFAVu5wx30J6DrTE6VdyDfWJqYpg+qt4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [result.id = _t, result.metadata.name = _t, result.metadata.label = _t, result.metadata.value = _t]),
    RemovedColumns = Table.RemoveColumns(Source,{"result.metadata.name"}),
    GroupedRows = Table.Group(RemovedColumns, {"result.id"}, {{"All", each Table.PromoteHeaders(Table.Transpose(Table.RemoveColumns(_, {"result.id"}, MissingField.Error))), type table}}),
    ExpandedAll = Table.ExpandTableColumn(GroupedRows, "All", List.Distinct(RemovedColumns[result.metadata.label]))
in
    ExpandedAll

 

 

v2

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY+7CsJAEEX/ZesQ9qlpfRQ2imAZUoxmwYDZyD4E/Xp3o0QzSTNz4R6GOWVJmBBSKq5IRk4efHD/AS6+eZAqG2Fb8PqzQhs3ZTktck7pEoOHLg3bM1xIhftVXVvtXJ9SSFfX2t4ag8mjtq4z4+C1xdimC8anc+YF11sMXHwRpRacsVnHO7jBccBmHGV0jB0Cf45CFAVu5wx30J6DrTE6VdyDfWJqYpg+qt4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [result.id = _t, result.metadata.name = _t, result.metadata.label = _t, result.metadata.value = _t]),
    RemovedColumns = Table.RemoveColumns(Source,{"result.metadata.name"}),
    PivotedColumn = Table.Pivot(RemovedColumns, List.Distinct(RemovedColumns[result.metadata.label]), "result.metadata.label", "result.metadata.value", each _),
    Transform = Table.TransformColumns(PivotedColumn, List.Transform(List.Distinct(RemovedColumns[result.metadata.label]), (colName)=> { colName, each _{0} }))
in
    Transform

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Great, looks really good at the moment. So you group the columns and expand the lines to separate columns. I will check it later, but thanks a lot.

You're welcome. Yes, in v1 I use group with some transformation inside.

In v2 I use Pivot Column but without additional transformation this would not work.


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors
Top Kudoed Authors