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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
tdoolittle
Frequent Visitor

Power Automate 'Export To File for Paginated Reports' Stop if Output is Empty

Hi,

I've spent a long time browsing various forums and use cases but I can't seem to find a solution for something that seems simple. Here are the steps of my cloud flow:

  1. Recurrence (output on a schedule)
  2. Export To File for Paginated Reports (create the output in PDF format)
  3. Create blob (V2) (drop the PDF file in an Azure blob endpoint)

Before step 3 occurs, I'm trying to find a way to check that the file that was created contains data, based on the underlying query that is executed in Power BI Report Builder. It seems there might be a solution to try to drop it in SharePoint first, then get the metadata to check the file size, if it's above a certain amount then move to the create blob step, and delete the temporary SharePoint file. But that seems ridiculous since the output is being stored within the flow before being saved to the blob, there surely should be some way to check the metadata of step 2 to determine if the output is going to be blank, and if so abandon the rest of the flow? Thanks!

1 ACCEPTED SOLUTION
tdoolittle
Frequent Visitor

After much searching and testing, I found a solution that works for me. Even though the steps appear to go in a certain order, the [Export To File for Paginate Reports] does not appear to hold the file temporarily somewhere, it directly exports into the target location.

 

The solution was to add steps after [Create blob (V2)] which do the following:

  • Under [Azure Blob Storage], [List blobs (V2)] at the [Create blob (V2)] location, which retrieves the metadata of all items
  • Under [Control], [Apply to each], which will create a for each loop on the result set of the [List blobs (V2)] step
  • Under [Control], [Condition], take the [Size] attribute from the [List blobs (V2)] step and check that it's less than the minimum file size in bytes
    • If true, then use [Azure Blob Storage], [Delete blob (V2)] and pass the [Id] attribute from the [List blobs (V2)] step
    • If false, then do nothing

View solution in original post

1 REPLY 1
tdoolittle
Frequent Visitor

After much searching and testing, I found a solution that works for me. Even though the steps appear to go in a certain order, the [Export To File for Paginate Reports] does not appear to hold the file temporarily somewhere, it directly exports into the target location.

 

The solution was to add steps after [Create blob (V2)] which do the following:

  • Under [Azure Blob Storage], [List blobs (V2)] at the [Create blob (V2)] location, which retrieves the metadata of all items
  • Under [Control], [Apply to each], which will create a for each loop on the result set of the [List blobs (V2)] step
  • Under [Control], [Condition], take the [Size] attribute from the [List blobs (V2)] step and check that it's less than the minimum file size in bytes
    • If true, then use [Azure Blob Storage], [Delete blob (V2)] and pass the [Id] attribute from the [List blobs (V2)] step
    • If false, then do nothing

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors