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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nandic
Memorable Member
Memorable Member

Export to file for paginated reports - count rows

Hi,
Task: export file for paginated report > check if file has at least 2 rows > if yes, send it in attachment.
Note: it will always have at least 1 row - header, this is why i need to check if it has at least 2 rows.
Additionally, i see that there is such option if data in Excel is set as table. However, in this case it is plain Excel without any tables.

nandic_0-1648196386358.png


Best regards,
Nemanja

3 REPLIES 3
lbendlin
Super User
Super User

In a roundabout way, run a DAX query against your dataset to find out how many rows will be returned.

Datasets - Execute Queries - REST API (Power BI Power BI REST APIs) | Microsoft Docs

Then run the export and do the following steps accordingly.

Hi @lbendlin ,
Thank you for suggestion.

In my scenario, power automate flow refreshes 100+ different reports and send out emails with attachment (refreshed paginated report). 
At this moment there are 2 work-arounds:
1) run sql statement to check number of rows for each report - this duplicates number of queries on database, but it works

2) save exported file on sharepoint, create table, check number of rows, delete file - it is not efficient and not  stable at all

 

It would be ideal to have only one refresh per report and based on that refresh (Excel file export) to count number of rows. I tried a few options, but always getting error that i can't convert object to array.. but couldn't find any option how to make it.

Best regards,
Nemanja

go with your first workaround if you are confident that the number of rows in SQL matches the number of rows in the dataset query.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors