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
Hi. I have a complex case and I appreciate your help to transform my data.
I have this raw data
I would like to tranform my data to this table. I tried to search for solutions to make my in betweenrow data into separate columns. Thank you very much for your help.
Solved! Go to Solution.
Hi @third_hicana, here you are (but you provided wrong data in expected result for ID P002 - Project B)
Result
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCjAwMFTSUQooys9KTS5RcASynRMLUiuAtKGBAZAEoVidaBAdYmBgqmdkamYJZPtD1ACRsSlIGZCAqgIpzC9JzIGbgKIAaJ8Rkn1OSPZBkCHCJKB9hnqmZhamCPuMoEYhHIVkHUISbEgsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"Project Name" = _t, Budget = _t, Jan = _t, Feb = _t, March = _t]),
ReplacedValue = Table.ReplaceValue(Source,"",null,Replacer.ReplaceValue,{"ID", "Project Name"}),
Ad_Project = Table.AddColumn(ReplacedValue, "Project", each try if Text.StartsWith([Project Name], "Project", Comparer.OrdinalIgnoreCase) then [Project Name] else null otherwise null, type text),
FilledDown = Table.FillDown(Ad_Project,{"ID", "Project Name", "Project"}),
UnpivotedOtherColumns = Table.UnpivotOtherColumns(FilledDown, {"ID", "Project Name", "Budget", "Project"}, "Month", "Value"),
ChangedType = Table.TransformColumnTypes(UnpivotedOtherColumns,{{"Value", type number}}),
PivotedColumn = Table.Pivot(ChangedType, List.Distinct(ChangedType[Budget]), "Budget", "Value", List.Sum),
GroupedRows = Table.Group(PivotedColumn, {"ID", "Project", "Month"}, {{"All", each Table.FillDown(_, List.Distinct(Source[Budget])), type table}}),
CombinedAll = Table.Combine(GroupedRows[All]),
FilteredRows = Table.SelectRows(CombinedAll, each not Text.StartsWith([Project Name], "Project", Comparer.OrdinalIgnoreCase)),
Ad_SortHelper = Table.AddColumn(FilteredRows, "SortHelper", each Date.FromText("2024-" & Text.Start([Month], 3) & "-01", [Format="yyyy-MMM-dd", Culture="en-US"]), type date),
SortedRows = Table.Sort(Ad_SortHelper,{{"ID", Order.Ascending}, {"SortHelper", Order.Ascending}}),
RemovedColumns = Table.RemoveColumns(SortedRows,{"SortHelper"})
in
RemovedColumns
Hi @third_hicana, here you are (but you provided wrong data in expected result for ID P002 - Project B)
Result
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCjAwMFTSUQooys9KTS5RcASynRMLUiuAtKGBAZAEoVidaBAdYmBgqmdkamYJZPtD1ACRsSlIGZCAqgIpzC9JzIGbgKIAaJ8Rkn1OSPZBkCHCJKB9hnqmZhamCPuMoEYhHIVkHUISbEgsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"Project Name" = _t, Budget = _t, Jan = _t, Feb = _t, March = _t]),
ReplacedValue = Table.ReplaceValue(Source,"",null,Replacer.ReplaceValue,{"ID", "Project Name"}),
Ad_Project = Table.AddColumn(ReplacedValue, "Project", each try if Text.StartsWith([Project Name], "Project", Comparer.OrdinalIgnoreCase) then [Project Name] else null otherwise null, type text),
FilledDown = Table.FillDown(Ad_Project,{"ID", "Project Name", "Project"}),
UnpivotedOtherColumns = Table.UnpivotOtherColumns(FilledDown, {"ID", "Project Name", "Budget", "Project"}, "Month", "Value"),
ChangedType = Table.TransformColumnTypes(UnpivotedOtherColumns,{{"Value", type number}}),
PivotedColumn = Table.Pivot(ChangedType, List.Distinct(ChangedType[Budget]), "Budget", "Value", List.Sum),
GroupedRows = Table.Group(PivotedColumn, {"ID", "Project", "Month"}, {{"All", each Table.FillDown(_, List.Distinct(Source[Budget])), type table}}),
CombinedAll = Table.Combine(GroupedRows[All]),
FilteredRows = Table.SelectRows(CombinedAll, each not Text.StartsWith([Project Name], "Project", Comparer.OrdinalIgnoreCase)),
Ad_SortHelper = Table.AddColumn(FilteredRows, "SortHelper", each Date.FromText("2024-" & Text.Start([Month], 3) & "-01", [Format="yyyy-MMM-dd", Culture="en-US"]), type date),
SortedRows = Table.Sort(Ad_SortHelper,{{"ID", Order.Ascending}, {"SortHelper", Order.Ascending}}),
RemovedColumns = Table.RemoveColumns(SortedRows,{"SortHelper"})
in
RemovedColumns
Hi @dufoq3
Yes. Sorry. I copied the wrong values for Project B but you got what I wish to do. Thank you very much for your help
Third
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 |