Kopīgot, izmantojot


Enable persistent filters

In reports you embed for your organization, when the persistent filters feature is enabled, reports retain their state, including filters, slicers, and other data view changes. When your user opens a report, the saved user state loads into the report. Also, the user gets the same user state in the different scenarios if persistent filters is enabled.

To reset the persistent filters in an embed scenario, you'll need to implement a button and use the resetPersistentFilters API, or show the action bar to get the Power BI Reset to default button on the action bar.

How to enable persistent filters

Persistent filters are disabled by default. To enable persistent filters, follow the steps in this section.

  1. Verify that persistent filters are enabled in the report settings in the Power BI service or desktop.

  2. Verify that your Azure Active Directory (Azure AD) app has UserState.ReadWrite.All permissions.

  3. Set the persistentFiltersEnabled property to true.

    let config = {
        type: 'report',
        ...
        settings: {
            persistentFiltersEnabled: true
        }
    };

The report is loaded with the latest user's report state, if the state exists. The user's report state is automatically saved after 60 seconds, without any change.

Note

Only updates to existing filters are saved. New filters that are added by the setFilters API won't be saved.

Persistent filters APIs

Reset persistent filters

Reset a user's filters, slicers, and other data view changes to the report's default state.

    resetPersistentFilters(): Promise<void>

Save persistent filters

Save the user's report filters, slicers, and other data view changes.

    savePersistentFilters(): Promise<void>

Persistent filters applied

Returns a user's filters, slicers, or other data view changes applied on the report, if they exist. If persistent filters are disabled, this returns false.

You can use this API to determine the reset button state.

    arePersistentFiltersApplied(): Promise<boolean>

Considerations and limitations

Persistent filters are supported only for the embed for your organization (user owns data) solution.