Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have few paginated reports in my Power BI Premium.
Opening the report, put the parameters, viewing the report(around 16 rows) took about 5 secondsm and exporting it as a pdf manually takes around another 5 seconds.
I created an dotnet funtion app to automate this process. For each report, it took around 40 seconds to get the exportId (by calling this method, _powerBiClient.Reports.ExportToFileAsync(groupId, reportId, exportReportRequest)), and totally around 100 seconds to get the file stream.
Is there any way to speed it up?
Thanks,
Xiaojun Xie
// This step took around 40 seconds
var export = await _powerBiClient.Reports.ExportToFileAsync(groupId, reportId, exportReportRequest);
stopwatch.Stop();
var elapsedTime = stopwatch.ElapsedMilliseconds;
Console.WriteLine(elapsedTime);
var exportId = export.Id;
HttpOperationResponse<Export> httpMessage = null;
Export exportStatus = null;
var startTime = DateTime.UtcNow;
const int c_secToMillisec = 1000;
do
{
if (DateTime.UtcNow.Subtract(startTime).TotalMinutes > 5)
{
// Error handling for timeout and cancellations
return null;
}
exportStatus = await _powerBiClient.Reports.GetExportToFileStatusAsync(groupId, reportId, exportId);
}
// While not in a terminal state, keep polling
while (exportStatus.Status != ExportState.Succeeded && exportStatus.Status != ExportState.Failed);
if (exportStatus.Status != ExportState.Succeeded)
{
// Error, failure in exporting the report
return null;
}
var fileStream = await _powerBiClient.Reports.GetFileOfExportToFileAsync(groupId, reportId, export.Id);
total.Stop();
var time = total.ElapsedMilliseconds;
Console.WriteLine($"Total: {filename} ---- {time}");
return new ExportedFile
{
FileStream = fileStream,
FileSuffix = export.ResourceFileExtension,
Filename = filename
};
You have not indicated how complex your reports are. Rendering time will be impacted by that. It will also be impacted by the performance of your server hardware, available memory, other users doing stuff etc.
Hi @lbendlin ,
Thanks for your reply.
I don't think it's a complex report. When I tried on Portal, only took few seconds(less than 10) to get the pdf.
But when using REST API, way slower even 1 report, which will took around 20-30 seconds.
Currently I have 5 capacities, one with 4 cores, the other 4 with 1 core for each. And I'm trying to concurrently export around 100 reports, took around 5-6 minutes in total. Do you know what's the best practice to export a lot report parallel?
Thanks,
Vic (Xiaojun) Xie
8 cores per machine, 32GB of RAM each.
User | Count |
---|---|
5 | |
4 | |
3 | |
2 | |
2 |
User | Count |
---|---|
8 | |
7 | |
4 | |
4 | |
4 |