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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
pbi1908
Helper III
Helper III

Create a flag if a table contains a string before expand.

Hi all, 

 

I am connected to a folter with PDFs, i receive these PDFs once a month and the structure of the PDF is not standard, sometimes the customer send me a PDF with 10 pages, sometimes with 2 pages since it's a PDF for claims so he include also photos in the PDFs. 

 

My problem is that i want to choose a specific table from PDF which sometimes is the table 1, sometimes the table 15 so i want to dynamically choose load this table. 

 

 

My final goal is to just add the PDF in the folder and the Power Query to understand in which table need to apply the rest of the steps. 

 

 

So my table always in the "Column1" contains the Word "Container" so my idea is to create a flag before expand the tables which Column of the table contains this word and choose only this, but i am not able to create the flag. 

 

 

"= Table.AddColumn(#"Filtered Rows", "Custom", each Table.SelectRows([Data],each ([Column1] = "Container") ))"

 

With the above i just filter the table that i want with this row. I also tried the below  but again is not working. 

 

"= if Table.ExpandTableColumn(#"Filtered Rows", "Custom", {"Column1"} = "Container" then 1 else 0)"

 

 

My data looks like this and the table that i want in that case is the table 12. 

 

pbi1908_0-1681501105513.png

 

1 REPLY 1
Anonymous
Not applicable

Hi @pbi1908 

You can try the following code

 

Table.AddColumn(#"Filtered Rows", "Custom", each if List.Contains([Data][Column1],"Container") then 1 else 0)

 

 

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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