Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi Folks,
I have the following issue, and I am not sure how should I fix it. What I am trying to do is basically separate text by commas from a single column I tried to use the Add Column > Extract option, but since there is a lot of text and it does not follow a patron I am struggling on it.
I have the following text as example:
And sometimes the Column A the patron is not the same for example it could be only Effort,other and I need to have all the efforts on the same column, and all the Others in the same column.
Basically, I am trying to classify these text. I would really appreciate your help, if anyone can suggest me any idea?
Thank you so much.
Solved! Go to Solution.
Hi, @Anonymous
Based on your description, I assume that you want to align the split text to the right. I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may apply the following transformations in the 'Advanced Editor'.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8s7LL89JTUlPTUzKSdVxzS1ILMlILclM1nFNS8tMzkzNK9FxzkksyiypBInkF5Xo+AMVFCnF6kQrkaiasBLsErEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Column A" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column A", type text}}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column A", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Column A.1", "Column A.2", "Column A.3", "Column A.4", "Column A.5", "Column A.6"}),
#"Added Custom" = Table.AddColumn(#"Split Column by Delimiter", "Custom", each List.RemoveNulls( Record.ToList(_) )),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each List.Count([Custom])),
Custom1 = Table.TransformColumns(#"Added Custom1",{"Custom",each let
l=List.Max(#"Added Custom1"[Custom.1]),
res=List.Combine({ List.Repeat({null},l-List.Count(_)),_})
in
res
}),
#"Removed Columns" = Table.RemoveColumns(Custom1,{"Column A.1", "Column A.2", "Column A.3", "Column A.4", "Column A.5", "Column A.6", "Custom.1"}),
Custom2 = Table.TransformColumns(#"Removed Columns",{"Custom",each Record.FromList(_,Table.ColumnNames(#"Split Column by Delimiter") )}),
#"Expanded Custom" = Table.ExpandRecordColumn(Custom2, "Custom", {"Column A.1", "Column A.2", "Column A.3", "Column A.4", "Column A.5", "Column A.6"}, {"Column A.1", "Column A.2", "Column A.3", "Column A.4", "Column A.5", "Column A.6"})
in
#"Expanded Custom"
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
Based on your description, I assume that you want to align the split text to the right. I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may apply the following transformations in the 'Advanced Editor'.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8s7LL89JTUlPTUzKSdVxzS1ILMlILclM1nFNS8tMzkzNK9FxzkksyiypBInkF5Xo+AMVFCnF6kQrkaiasBLsErEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Column A" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column A", type text}}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column A", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Column A.1", "Column A.2", "Column A.3", "Column A.4", "Column A.5", "Column A.6"}),
#"Added Custom" = Table.AddColumn(#"Split Column by Delimiter", "Custom", each List.RemoveNulls( Record.ToList(_) )),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each List.Count([Custom])),
Custom1 = Table.TransformColumns(#"Added Custom1",{"Custom",each let
l=List.Max(#"Added Custom1"[Custom.1]),
res=List.Combine({ List.Repeat({null},l-List.Count(_)),_})
in
res
}),
#"Removed Columns" = Table.RemoveColumns(Custom1,{"Column A.1", "Column A.2", "Column A.3", "Column A.4", "Column A.5", "Column A.6", "Custom.1"}),
Custom2 = Table.TransformColumns(#"Removed Columns",{"Custom",each Record.FromList(_,Table.ColumnNames(#"Split Column by Delimiter") )}),
#"Expanded Custom" = Table.ExpandRecordColumn(Custom2, "Custom", {"Column A.1", "Column A.2", "Column A.3", "Column A.4", "Column A.5", "Column A.6"}, {"Column A.1", "Column A.2", "Column A.3", "Column A.4", "Column A.5", "Column A.6"})
in
#"Expanded Custom"
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @Anonymous ,
I don't understand your request.
Please check out these tips to get you questions answered quickly:
help how to get your questions answered quickly - Microsoft Power BI Community
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
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 8 | |
| 7 |