This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi all
I'm hoping someone can help me get past a big hurdle.. I have the following issue
My data is coming in as a single column
Raw Data
.I need it to become this...
Can anyone let me know if this is doable etc.
Many thanks in advance
Mary
Solved! Go to Solution.
I don't know if this is the optimal solution, but I did it this way:
let
Source = Excel.Workbook(File.Contents("M:\Reports\test.xlsx"), null, true),
Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"Index", Int64.Type}}),
#"Added Sorter" = Table.AddColumn(
#"Changed Type",
"Sorter",
each Number.From(
List.Min(
List.Range(
List.Repeat(
{1, 2, 3, 4, 5, 6, 7, 8},
Int32.From(
(List.Count(#"Changed Type"[Index]) / 8),
null,
RoundingMode.Up
)
),
[Index] - 1,
1
)
)
)
),
#"Added Name" = Table.AddColumn(
#"Added Sorter",
"Name",
each Text.From(
List.Last(
List.FirstN(
#"Added Sorter"[Column1],
[Index] - ([Sorter] - 1)
),
1
)
)
),
#"Reordered Columns" = Table.ReorderColumns(
#"Added Name",
{"Index", "Sorter", "Name", "Column1"}
),
#"Removed Rows" = Table.SelectRows(
#"Reordered Columns",
each [Sorter] > 1
),
#"Removed Columns" = Table.RemoveColumns(#"Removed Rows",{"Index"}),
#"Pivoted Column" = Table.Pivot(
Table.TransformColumnTypes(
#"Removed Columns",
{{"Sorter", type text}},
"en-US"
),
List.Distinct(Table.TransformColumnTypes(#"Removed Columns", {{"Sorter", type text}}, "en-US")[Sorter]),
"Sorter",
"Column1"
)
in
#"Pivoted Column"
This is very similar, but a bit shorter:
let
Source = Excel.CurrentWorkbook(){[Name="Tabelle1"]}[Content],
#"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1),
RowNumber = Table.AddColumn(#"Added Index", "Custom", each Number.RoundUp([Index]/8)),
PivotCols = Table.AddColumn(RowNumber, "Pivot", each Number.Mod([Index], 8)),
RemoveIndex = Table.RemoveColumns(PivotCols,{"Index"}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(RemoveIndex, {{"Pivot", type text}}, "de-DE"), List.Distinct(Table.TransformColumnTypes(RemoveIndex, {{"Pivot", type text}}, "de-DE")[Pivot]), "Pivot", "Spalte1")
in
#"Pivoted Column"
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
I don't know if this is the optimal solution, but I did it this way:
let
Source = Excel.Workbook(File.Contents("M:\Reports\test.xlsx"), null, true),
Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"Index", Int64.Type}}),
#"Added Sorter" = Table.AddColumn(
#"Changed Type",
"Sorter",
each Number.From(
List.Min(
List.Range(
List.Repeat(
{1, 2, 3, 4, 5, 6, 7, 8},
Int32.From(
(List.Count(#"Changed Type"[Index]) / 8),
null,
RoundingMode.Up
)
),
[Index] - 1,
1
)
)
)
),
#"Added Name" = Table.AddColumn(
#"Added Sorter",
"Name",
each Text.From(
List.Last(
List.FirstN(
#"Added Sorter"[Column1],
[Index] - ([Sorter] - 1)
),
1
)
)
),
#"Reordered Columns" = Table.ReorderColumns(
#"Added Name",
{"Index", "Sorter", "Name", "Column1"}
),
#"Removed Rows" = Table.SelectRows(
#"Reordered Columns",
each [Sorter] > 1
),
#"Removed Columns" = Table.RemoveColumns(#"Removed Rows",{"Index"}),
#"Pivoted Column" = Table.Pivot(
Table.TransformColumnTypes(
#"Removed Columns",
{{"Sorter", type text}},
"en-US"
),
List.Distinct(Table.TransformColumnTypes(#"Removed Columns", {{"Sorter", type text}}, "en-US")[Sorter]),
"Sorter",
"Column1"
)
in
#"Pivoted Column"
@Anonymous Thanks LOADS!!! Very much appriate your input. Mary 🙂
Thanks. It was a fun problem to tackle. I'm sure there's a more efficient way to do the Sorter column, but that was the best I could think of. I'd be interested to see if someone else has a different solution to this.
This is very similar, but a bit shorter:
let
Source = Excel.CurrentWorkbook(){[Name="Tabelle1"]}[Content],
#"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1),
RowNumber = Table.AddColumn(#"Added Index", "Custom", each Number.RoundUp([Index]/8)),
PivotCols = Table.AddColumn(RowNumber, "Pivot", each Number.Mod([Index], 8)),
RemoveIndex = Table.RemoveColumns(PivotCols,{"Index"}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(RemoveIndex, {{"Pivot", type text}}, "de-DE"), List.Distinct(Table.TransformColumnTypes(RemoveIndex, {{"Pivot", type text}}, "de-DE")[Pivot]), "Pivot", "Spalte1")
in
#"Pivoted Column"
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Thanks loads @ImkeF. I am so pleased to have a solution plus I learnt alot too.
Sorry I should have said thank you @Anonymous & @ImkeF as I have two solutions to learn new stuff from.
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 29 | |
| 25 | |
| 25 | |
| 21 | |
| 14 |
| User | Count |
|---|---|
| 61 | |
| 50 | |
| 25 | |
| 20 | |
| 20 |