Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi, I need to loop through some PDFs. While much of the data is uniform, some lines are not. I have figured out how to use power query to extract data from individuals PDFs, therefore accouting differences between files, but not sure how to create a loop with conditional logic? to deal with each PDF?
Thank you,
Steve
Hi @se2 ,
Whether the advice given by @vicky_ has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
OK. I think I will create a custom query and use parameters if needed. Will add conditional columns to bring in irregular data. Still not sure how to loop through the files in a folder and apply the custom query to each file.
looks like loops are in m-code but not in the power question menu.
There isn't really a way to loop through conditions, however, there are some ways around it.
The easiest built-in method is to use the folder connector - https://learn.microsoft.com/en-us/power-query/connectors/folder. You can try put all your PDFs in the same folder, and then transform one of them. Once you load it into your data, the transformation will be applied to all PDFs in the file. With this method, the same tranformations are applied to all files in the folder, so there's not a lot of flexibility.
Otherwise, there are ways to write functions in M - this will be a bit more involved coding-wise. I recommend checking out https://blog.crossjoin.co.uk/2016/05/15/creating-m-functions-from-parameterised-queries-in-power-bi/...and https://learn.microsoft.com/en-us/power-query/custom-function for more details.
Thank you, I will try
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
71 | |
57 | |
38 | |
36 |
User | Count |
---|---|
81 | |
67 | |
62 | |
46 | |
45 |