Forum Discussion
Export to file - Power BI Report with Filters / Parameters
- Anonymous6 years ago
Hi Anonymous
The documentation currently states that the Bookmark name (whilst accepted as a parameter) is not currently available.
https://docs.microsoft.com/en-us/rest/api/power-bi/reports/exporttofile#pagebookmark
The only way to update output via bookmarks, is to pass in the bookmark state.
And the only way that you can get the bookmark state (that I know of) is via the JavaScript API. https://github.com/Microsoft/PowerBI-JavaScript/wiki/Bookmarks#capture-and-get-a-current-view-as-a-bookmark-object-and-apply-it-back-on-the-current-session
The 'capture' function will return a single string value that represents the bookmark state. You can then pass this into the API.
This is far from ideal... but I think the export API endpoint is still under preview, so will likely change quite a bit.
The idea I raised for adding missing functionality to this API has also moved into the planned phase. So hopefully, it won't be too long before these missing features are available. https://ideas.powerbi.com/ideas/idea/?ideaid=0e056f7d-34b4-4778-974f-929228effcdd
Cheers, Matt
Hi craigbenstock - Any chance you've figured this out?? I'm in the same boat - wanting to apply a filter at runtime when exporting the report as PDF. I haven't been able to find a working example.
Thanks, Greg
Hi craigbenstock ,
Hope this helps you/somebody. Kept digging and finally have a working copy - this is from a PowerShell script - so it has the double-quotes preceded by a qualifier:
$body = "{ format : `"PDF`",
powerBIReportConfiguration : { reportLevelFilters : [{ filter : `"TableName/FieldName eq 'SomeValue'`" }]} }"
. . .which looks same/similar to your version.
I used the "Try It" option from the MS documentation page to tweak the body formatting until I got a 20x response code:
https://docs.microsoft.com/en-us/rest/api/power-bi/reports/exporttofileingroup
And here's the page documenting that filtering is possible - it's too bad they don't provide a full, soup-to-nuts working copy that includes a filter example:
https://docs.microsoft.com/en-us/power-bi/developer/embedded/export-to#filters