Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
BO7
Regular Visitor

Separating Values Into Rows

I have a column that contains multiple ID's. The format of each cell is different; for example, I have a cell that looks like this:

 

[APP1234567APP9876543APP6789012]

 

I also have cells that look like this:

 

[APP1234567879;APP245674128;APP5558246]

 

I also have cells that have a combination of the above datasets. Is there a way to separate the data so that each value that starts with 'APP' has its own row? The delimiter function is not helping me with this.

1 ACCEPTED SOLUTION
SundarRaj
Solution Supplier
Solution Supplier

Hi @BO7 , here's another solution you could look. Thanks!

SundarRaj_0-1745483970090.png

SundarRaj_1-1745484011475.png

Here's the code:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Texts", type text}}),
Number = Table.TransformColumns(#"Changed Type",{}, each List.Count(Text.PositionOf(_,"A",Occurrence.All)) + 1),
ColNumber = List.Max(Number[Texts]),
ColNames = List.Transform({1..ColNumber}, each "Col" & Text.From(_)),
Custom1 = #"Changed Type",
#"Split Column by Delimiter" = Table.SplitColumn(Custom1, "Texts", Splitter.SplitTextByDelimiter("APP", QuoteStyle.Csv), ColNames),
#"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter",{"Col1"}),
Custom2 = Table.TransformColumns(#"Removed Columns",{}, each Text.Replace("APP" & _,";","")),
Custom3 = Table.FromList(List.Combine(Table.ToRows(Custom2)))
in
Custom3

 

 

Sundar Rajagopalan

View solution in original post

3 REPLIES 3
SundarRaj
Solution Supplier
Solution Supplier

Hi @BO7 , here's another solution you could look. Thanks!

SundarRaj_0-1745483970090.png

SundarRaj_1-1745484011475.png

Here's the code:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Texts", type text}}),
Number = Table.TransformColumns(#"Changed Type",{}, each List.Count(Text.PositionOf(_,"A",Occurrence.All)) + 1),
ColNumber = List.Max(Number[Texts]),
ColNames = List.Transform({1..ColNumber}, each "Col" & Text.From(_)),
Custom1 = #"Changed Type",
#"Split Column by Delimiter" = Table.SplitColumn(Custom1, "Texts", Splitter.SplitTextByDelimiter("APP", QuoteStyle.Csv), ColNames),
#"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter",{"Col1"}),
Custom2 = Table.TransformColumns(#"Removed Columns",{}, each Text.Replace("APP" & _,";","")),
Custom3 = Table.FromList(List.Combine(Table.ToRows(Custom2)))
in
Custom3

 

 

Sundar Rajagopalan

Thank you! I was pulling my hair out trying to figure this one out.

jgeddes
Super User
Super User

You can create a list for each row using Text.Split() and "APP" as the value to split on.
Remove any blank rows from the resulting list and then remove any non-number characters. 
Add "APP" back to the start of each row of the list.
Delete the original column.

Expand the lists into rows.

Example code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcgwIMDQyNjE1MweyLC3MzUxNjIEsM3MLSwNDI6VYHWQlFuaW1kCeEYhtYmhkAeKYmppaGJmYKcXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Transform(List.RemoveItems(Text.Split([Column1], "APP"), {""}), each "APP" & Text.Select(_, {"1".."9"})), type list),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column1"}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Removed Columns", "Custom")
in
    #"Expanded Custom"

jgeddes_0-1745442053431.png

 

jgeddes_1-1745442068567.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors