cancel
Showing results for 
Search instead for 
Did you mean: 
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.

nandic
Memorable Member
Memorable Member

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
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show episode 9

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors
Top Kudoed Authors