Forum Discussion
Power BI Embedded Export ignores programmatically set filters in Bookmark state
Hi
We are using Power BI Embedded with the Export to File API and passing a fully precomputed bookmark state inside the export request payload.
Our export request looks like this:
{
"format": "PDF",
"powerBIReportConfiguration": {
"datasetToBind": "xxxx",
"identities": [
{
"username": "xxxx",
"roles": ["xxxx"],
"datasets": ["xxxx"]
}
],
"pages": [
{
"pageName": "xxx",
"bookmark": {
"state": "<compressed bookmark state>"
}
}
]
}
}
I observe the filters applied by user (via slicers/UI) are correctly included in the exported result, but the filters applied programmatically with Api setFilters() not included
How can I include filters set via API as well?
Thanks
Hi DavideBono97,
Thank you for reaching out through the Microsoft Fabric Community Forum.
Based on our understanding, the export operation only respects the state serialized within the bookmark payload along with any explicitly supported export filters. Filters applied interactively through slicers or the user interface are included because they become part of the captured bookmark state. However, filters applied programmatically are treated as runtime or session filters and are not automatically persisted into an already precomputed bookmark state, unless a new bookmark is captured after those filters have been applied.
One possible approach is to first apply the filters using setFilters(), wait for the report rendering to complete by listening to the report.on("rendered") event, then dynamically capture a new bookmark state using await report.bookmarksManager.capture(), and finally pass that captured bookmark state into the Export To File request. Precomputed bookmark states should be regarded as static snapshots and might not automatically incorporate subsequent API filter changes.
Additionally, kindly refer the links below:
Export Power BI embedded analytics reports API - Power BI | Microsoft Learn
Reports - Export To File - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Enhance your users' experience with bookmarks in Power BI embedded analytics | Microsoft Learn
Use filters in a Power BI embedded analytics report | Microsoft Learn
How to handle events in a Power BI embedded analytics application | Microsoft LearnWe hope the information shared above helps resolve the issue. Should you have any further queries, please feel free to contact the Microsoft Fabric community.
Thank you.
2 Replies
- v-pnaroju-msftCommunity Support
Hi DavideBono97,
Thank you for reaching out through the Microsoft Fabric Community Forum.
Based on our understanding, the export operation only respects the state serialized within the bookmark payload along with any explicitly supported export filters. Filters applied interactively through slicers or the user interface are included because they become part of the captured bookmark state. However, filters applied programmatically are treated as runtime or session filters and are not automatically persisted into an already precomputed bookmark state, unless a new bookmark is captured after those filters have been applied.
One possible approach is to first apply the filters using setFilters(), wait for the report rendering to complete by listening to the report.on("rendered") event, then dynamically capture a new bookmark state using await report.bookmarksManager.capture(), and finally pass that captured bookmark state into the Export To File request. Precomputed bookmark states should be regarded as static snapshots and might not automatically incorporate subsequent API filter changes.
Additionally, kindly refer the links below:
Export Power BI embedded analytics reports API - Power BI | Microsoft Learn
Reports - Export To File - REST API (Power BI Power BI REST APIs) | Microsoft Learn
Enhance your users' experience with bookmarks in Power BI embedded analytics | Microsoft Learn
Use filters in a Power BI embedded analytics report | Microsoft Learn
How to handle events in a Power BI embedded analytics application | Microsoft LearnWe hope the information shared above helps resolve the issue. Should you have any further queries, please feel free to contact the Microsoft Fabric community.
Thank you.
- v-pnaroju-msftCommunity Support
Hi DavideBono97,
We would like to follow up and see whether the details we shared have resolved your problem. If you need any more assistance, please feel free to connect with the Microsoft Fabric community.
Thank you.