Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Dear All
I would like to know if the following is possible?
I would have a large set of data and the number of columns depends on the no. of rows the data appears.
Some can be 1, 2, 3, 4 or 5 columns.
Thank you in advance!
| Data | |
| Unique Reference | Column 2 |
| 2404124231223097 | TMPN |
| 2404124231223097 | 3770808102FS |
| 2404124231223080 | 9135793102FS |
| 2404124231223085 | REPAYMENT |
| 2404124231223085 | /BOOK |
| 2404124231223085 | 3254675102FS |
| 2404124231223084 | USD10 |
| 2404124231223084 | REPAYMENT |
| 2404124231223084 | 039190 |
| 2404124231223084 | 1447267102FS |
| 2404124231223094 | BORROWING |
| 2404124231223094 | //BASE |
| 2404124231223094 | 5971952102FS |
| 2404124231223094 | /ACC |
| 2404124231223094 | 00005ILC240004 |
| Result | |||||
| Unique Reference | Column 1 | Column 2 | Column 3 | Column 4 | Column 5 |
| 2404124231223097 | TMPN | 3770808102FS | |||
| 2404124231223080 | 9135793102FS | ||||
| 2404124231223085 | REPAYMENT | /BOOK | 3254675102FS | ||
| 2404124231223084 | USD10 | REPAYMENT | 039190 | 1447267102FS | |
| 2404124231223094 | BORROWING | //BASE | 5971952102FS | /ACC | 00005ILC240004 |
Solved! Go to Solution.
let
Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Unique Reference", type text}, {"Column 2", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Unique Reference"}, {
{"Records", each Record.FromList([Column 2], List.Transform(List.Numbers(1, List.Count([Column 2])), each "Column " & Text.From(_))) }}),
#"Col Names" = List.Sort(List.Distinct(List.Accumulate(
#"Grouped Rows"[Records],
{},
(s,c)=>s & Record.FieldNames(c)
))),
#"Expand Records" = Table.ExpandRecordColumn(#"Grouped Rows","Records", #"Col Names")
in
#"Expand Records"
Result from your data above:
Hi @howeixiong, different one here.
Result
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fc7BCoMwDMbxVxk9C03S1JijOjdk04o6xhDf/zVW78Ze/7/wddscMTASU0CiACqucOswjW4vTlsQgQoqBHosJ6aCbBRDFA2midnM3VT/hm5cb5bwTUovKwaKXEo0Jzibz3JHsOL1/iEgKKp5j8xCpVgf0MM0aZ7Ttx+fFvC+qZfOqlEFNdLlhK/b1mqQX+zfbU4A7Pb9Dw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Unique Reference" = _t, #"Column 2" = _t]),
GroupedRows = Table.Group(Source, {"Unique Reference"}, {{"All", each Table.FromRows(Table.ToColumns(Table.SelectColumns(_, {"Column 2"}))), type table}}),
ExpandedAll = Table.ExpandTableColumn(GroupedRows, "All", List.Transform({"1"..Text.From(Table.RowCount(GroupedRows))}, each "Column" & _))
in
ExpandedAll
let
Source = your_table,
to_list = Table.ToList(
Table.Group(Source, {"Unique Reference"}, {{"x", each [Column 2]}}),
(x) => {x{0}} & x{1}
),
cols = List.Max(List.Transform(to_list, List.Count)),
to_table = Table.FromList(to_list, (x) => x, cols)
in
to_table
let
Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Unique Reference", type text}, {"Column 2", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Unique Reference"}, {
{"Records", each Record.FromList([Column 2], List.Transform(List.Numbers(1, List.Count([Column 2])), each "Column " & Text.From(_))) }}),
#"Col Names" = List.Sort(List.Distinct(List.Accumulate(
#"Grouped Rows"[Records],
{},
(s,c)=>s & Record.FieldNames(c)
))),
#"Expand Records" = Table.ExpandRecordColumn(#"Grouped Rows","Records", #"Col Names")
in
#"Expand Records"
Result from your data above:
=Table.FromColumns(List.Zip(Table.Group(YourTableName,"Unique Reference",{"n",each {[Unique Reference]{0}}&[Column 2]})[n]))
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 4 |