Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Charlene
Frequent Visitor

Capabilities object - selfFilter

I see in capabilities object properties your able to set a selfFilter.

"selfFilter": {
"type": {
"filter": {
"selfFilter": true
}
}
}

I cant see any more details on this, as to how it works and how to implement it once its been set in capabilities.

Can anyone direct me to examples and details on this please?

 

I'm trying to filter my custom visual and not just the other visuals and thought this may be the correct solution, but struggling to get more details on how it works.

If anyone can please assist and advise?

Thank you

3 REPLIES 3
Anonymous
Not applicable

Hi  @Charlene ,

Please review the following links, hope they can help you.

Apply JSON Filter to own custom visual

With help of a fellow forum member I got it to work the way I want. You need to do the following to have your visual filter itself AND others visuals:

capabilities.json (general)

            "properties": {
                "filter": {
                    "type": {
                        "filter": true
                    }
                },
                "selfFilter": {
                    "type": {
                       "filter": {
                          "selfFilter": true
                       }
                    }
                 }
            }

 

ApplyJsonFilter call(s)

    this._visualHost.applyJsonFilter(
      filterList,
      "general",
      "selfFilter",
      powerbi.FilterAction.merge
    );
    this._visualHost.applyJsonFilter(
      filterList,
      "general",
      "filter",
      powerbi.FilterAction.merge
    );

schema.capabilities.json

Trying to filter data in custom visual

Best Regards

Thank you ‌‌

I added the above and still having an issue that its still not fitering correctly - Maybe you can advise?

Added the above property filter settings (capabilities) & the applyJsonFilter call

Strangly I now have that if I include the 'general' filter & its related applyJsonFilter call then it doesnt work at all and no fitering gets triggered

 

"properties": {
"filter": {
"type": {
"filter": true
}
},


However if I remove the above and only have the 'selfFilter' (with of course the applicable applyJsonFilter)  then it seems to filter my custom visual but the other powerBi visuals dont get filtered.

 

"selfFilter": {
"type": {
"filter": {
"selfFilter": true
}
}
}


Any ideas why the 'general' prorperies filter will cause all filtering not to work?

Thank you, I appreciate any suggestions and examples you can assist me with

PS: Did look at the linked examples and cant see anything out of the ordinary that id different and why mine isnt working

UPDATE: (2)

So although I got both filters to be active in capabilities, the selfFilter applyJsonFilter call works but the general filter doesnt seem to do anything and causes more problems (causing my other functionality to intimitantly not work correctly). When I remove the general filter and only use the selfFilter it seems to work correctly. So offically giving up on including the general filter in capabilities.

 

So as result to get my filters to work I needed to do the following:

1) Ensure my selectionArray contain the correct data (update and remove selections as click event triggered on my visaul) and this is passed to applyJsonFilter : This works and my custom visual now filters correctly (when click item on my cutom visual to filter by). My custom visaul also filters correctly if filter was triggered by another visaul

2) Now needed to add functionality to update the selection in my array if a new selection was triggered my an other visaul. Aka select item on my visaul then click other visaul with new selection or de-selection. This is also working correctly. My selectionArray update to new selection or clears array if de-selection.

 

Biggest problem now is that the persistantFilter on the powerBi toolbar doesnt seem to trigger / reflect corrrectly. If click my visual it has the correct filter data. However if I click another visaul then the persistantFilter doesnt trigger and reflect that there are active filters

 

Any suggestions to either get other visauls filter selection to reflect in the persistnatFilter or oterwise how do I completly disable / hide this button in my code

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.