Bookmarks are a great way to save the state of a report or dashboard, allowing users to easily return to that view later. This can be particularly useful for reports with many filters or interactions, enabling users to quickly jump back to a specific view they were interested in.
- Embedded Power BI reports
- .NET application to display the Power BI embedded reports.
- SQL Server to manage/store the custom bookmarks
1. Create the Report or Dashboard
2. Add the Visuals and Interactions
3. Create Bookmarks
Using the Ajax call, the information related to bookmarks like displayName, state, and the internal name (created so that we can differentiate between multiple bookmarks with the same name) and session-related details like current user ID and report ID on which bookmarks have been created can be saved in the database.
Click on the “Bookmark” icon in the “Visualizations” pane to create a new bookmark.
Give your bookmark a name and click “Add.” Repeat this step for each bookmark you want to create. You can now save these bookmarks in the table using Ajax call.
The table to store the personal custom-created bookmarks can be saved in the table whose schema is defined.
|Name||Nvarchar (50)||Name of the bookmark|
|DisplayName||Nvarchar (50)||Display the name of the bookmark visible on the page|
|ReportId||Nvarchar (50)||Guid of the report|
|UserId||Int||UserId of the logged-in user|
4. Get Bookmarks
When the embedded report is displayed on the browser, we can get the respective bookmarks created by the specific user for that report. To get the information on those bookmarks again, an Ajax call can be used.
To fetch the information of the bookmarks coming from the Power BI service, use the bookmarksManager.getBookmarks() function, which is defined in the powerbi.js.
The bookmark object consists of 3 items, namely,
- Name: Unique name of the bookmark.
- Display Name: Name which would be visible to the user on the browser.
- State: A Base64 string that holds the information of the filters and visuals of the report/dashboard.
5. Apply the Bookmarks
To apply the changes in the Power BI report, use the function applyState in the bookmarksManager. The function applyState is responsible for changing the state of the report when bookmark state is passed as the parameter.
Using the following steps, one can easily retain the bookmark in the embedded report.