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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Searching for words in a table and creating a new column containing that line in Power Query

I imported  a pdf and it came in shifted all over the place like below. These pdfs have a lot of lines but each row only contains one "Number of legs" data line.

Have.PNG

 

 

 

 

 

Is there any way to search through the table for "Number of legs" and make a new column like below with all the number of legs data in one column?

Want.PNG

1 ACCEPTED SOLUTION
Cmcmahan
Resident Rockstar
Resident Rockstar

Sure. This is best done in Power Query.  I'm assuming when it says null, that is actually a text field that says "null" and not the programmatic null.  If those are actual null values, then you can remove line 4, where I replace the word "null" with an actual null.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WyivNyVHSQVC5SalFCvlpCjmp6cVWCsZKsTrRuCQNYfogalAljZANxaHGEKsarHaZwNXEAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","null",null,Replacer.ReplaceValue,{"Column1", "Column2", "Column3"}),
    #"Added NewColumn" = Table.AddColumn(#"Replaced Value", "NewColumn", each Text.Combine({[Column1],[Column2],[Column3]}))
in
    #"Added NewColumn"

This will work if the entire import is just more of what you showed.  If there's other data, it will replace all instances of "null" with null and concatenate the entire line. Since nulls are not strings, they disappear.

 

View solution in original post

2 REPLIES 2
Cmcmahan
Resident Rockstar
Resident Rockstar

Sure. This is best done in Power Query.  I'm assuming when it says null, that is actually a text field that says "null" and not the programmatic null.  If those are actual null values, then you can remove line 4, where I replace the word "null" with an actual null.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WyivNyVHSQVC5SalFCvlpCjmp6cVWCsZKsTrRuCQNYfogalAljZANxaHGEKsarHaZwNXEAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","null",null,Replacer.ReplaceValue,{"Column1", "Column2", "Column3"}),
    #"Added NewColumn" = Table.AddColumn(#"Replaced Value", "NewColumn", each Text.Combine({[Column1],[Column2],[Column3]}))
in
    #"Added NewColumn"

This will work if the entire import is just more of what you showed.  If there's other data, it will replace all instances of "null" with null and concatenate the entire line. Since nulls are not strings, they disappear.

 

Anonymous
Not applicable

Thanks this works great!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors