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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to seperate particular text from a column and paste into another column.

Need to find "L0", L1" form column A and paste only the "L0", "L1" into column B.

Yoganandhan_01_0-1708507267746.png

 

Thanks..

1 ACCEPTED SOLUTION

but if you need it here's the full code from the query:

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8sxLy7dS8DFQitWJVgpKTbNScPRxQXB8DJViYwE=", 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 Custom1" = Table.AddColumn(#"Changed Type", "Custom.1", each let
L0Index = Text.PositionOf([Column1], "L0"),
L1Index = Text.PositionOf([Column1], "L1"),
L0 = if L0Index <> -1 then Text.Middle([Column1], L0Index, 2) else null,
L1 = if L1Index <> -1 then Text.Middle([Column1], L1Index, 2) else null,
Result = if L0 <> null and L1 <> null then L0 & ", " & L1 else if L0 <> null then L0 else if L1 <> null then L1 else null
in
Result)
in
#"Added Custom1"

 

DOLEARY85_0-1708509183343.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

View solution in original post

5 REPLIES 5
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

you can do this in power query using a custom column. Try this:

 

let
L0Index = Text.PositionOf([Column1], "L0"),
L1Index = Text.PositionOf([Column1], "L1"),
L0 = if L0Index <> -1 then Text.Middle([Column1], L0Index, 2) else null,
L1 = if L1Index <> -1 then Text.Middle([Column1], L1Index, 2) else null,
Result = if L0 <> null and L1 <> null then L0 & ", " & L1 else if L0 <> null then L0 else if L1 <> null then L1 else null
in
Result

 

DOLEARY85_0-1708507658014.png

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Anonymous
Not applicable

Hello @DOLEARY85

 

Thanks for your reply. I do face some Token EoF Error. Because of the the comma on the end of the first line. 

Yoganandhan_01_0-1708508025187.png

Could you please send me your custom coloumn formula on the query editor. That helps me a lot rather then normal copied text.

Thanks..!

You just need to add:

 

in
Result

 

to the bottom of the code you have there

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

but if you need it here's the full code from the query:

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8sxLy7dS8DFQitWJVgpKTbNScPRxQXB8DJViYwE=", 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 Custom1" = Table.AddColumn(#"Changed Type", "Custom.1", each let
L0Index = Text.PositionOf([Column1], "L0"),
L1Index = Text.PositionOf([Column1], "L1"),
L0 = if L0Index <> -1 then Text.Middle([Column1], L0Index, 2) else null,
L1 = if L1Index <> -1 then Text.Middle([Column1], L1Index, 2) else null,
Result = if L0 <> null and L1 <> null then L0 & ", " & L1 else if L0 <> null then L0 else if L1 <> null then L1 else null
in
Result)
in
#"Added Custom1"

 

DOLEARY85_0-1708509183343.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Anonymous
Not applicable

Thanks for your reply.!

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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