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 at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered
Hi, I'm new to pipelines and have been trying to find out how to control the flow of a pipline so it can exit succesfully if a condition is met.
The pipeline is on a schedule, each time it runs, it looks for files in a folder, if there are files there it continues with the rest of the activities, if not it should exit succesfully. I've tried using an If activity, but I can only get that to work if put a Fail activity in it. But this then shows up in the logs as the pipline failed which then needs checked.
Is there a way to get a pipeline to exit sucessfully if a condition is met so it doesn't run the rest of the activites?
Solved! Go to Solution.
Thanks Ben, I've got something like this set up and working. The issue is I can't add all my activities into the if activity as some of them are for loops and more if activites as well which aren't supported within an if activity.
I've reworked the pipeline to remove the loops and if conditions from within the if block and have got things working now. I've also started using pipeline return parameters which has helped as well.
hi @russellhq ,
You can add a set variable activity after the getmetadata and use this variable in the if condition activity.
The variable can be a boolean type and you can use exactly the function that @FabianSchut mentioned above inside this set variable and in the if condition you use (yourvariable==true)
Ben
Thanks Ben, I've got something like this set up and working. The issue is I can't add all my activities into the if activity as some of them are for loops and more if activites as well which aren't supported within an if activity.
I've reworked the pipeline to remove the loops and if conditions from within the if block and have got things working now. I've also started using pipeline return parameters which has helped as well.
Hi @russellhq,
You could use Get metadata with child items to check whether there are files in the folder at all. After your Get metadata activity, you can connect an If condition and check if there are 1 or more files in the folder. The condition for the If condition could be: @greater(length(activity('Get Metadata1').output.childItems), 0). Put all your activities in the True section of the if condition and nothing in the False section. This way, the pipeline will run succesfully without failures.
I though this would work and gave it a try. But because the actions I want to put in the IF activity are ForEach and IF activities as well, the pipeline doesn't allow them inside an IF block.
i believe you should have a script or logic to count the files you want, if that is true, invoke another pipeline, else, do nothing and end the current pipeline.
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 Fabric update to learn about new features.
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
2 |