Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
So I have been following the steps that were outlined here https://microsoft.github.io/PowerBI-visuals/docs/concepts/filter-api/#basic-filter-api
I created a basic filter:
Solved! Go to Solution.
Yep, I've realised now thanks.
It turns out the answer was simply to use
visualhost.applyJsonFilter(advancedFilter, "general", "selfFilter", FilterAction.merge);
instead of
visualhost.applyJsonFilter(advancedFilter, "general", "Filter", FilterAction.merge);
This will filter the visual and not all the other visuals.
Hi @Anonymous ,
this.visualHost.applyJsonFilter() pushes the filter back to Power BI so that all other visuals on the page are filtered by the content of the filter. It doesn't filter the data that the visual is getting; slicer are using the same technique.
-JP
Yep, I've realised now thanks.
It turns out the answer was simply to use
visualhost.applyJsonFilter(advancedFilter, "general", "selfFilter", FilterAction.merge);
instead of
visualhost.applyJsonFilter(advancedFilter, "general", "Filter", FilterAction.merge);
This will filter the visual and not all the other visuals.
Hey @Anonymous ,
I'm trying to achieve exactly the behaviour and have my custom visual filter itself. I can't get your solution to work, did you do any other changes regarding for example the capabilities?
regards,
lucmax
Hey lucmax,
So you need to add selfFilter to your general capabilities too. Like this. So instead of filter, replace with selfFilter. There is no documentation for this, so it was a lot of trial and error.
Thank you @Anonymous! That helped a lot. I tried changing them, but didn't do it with the double "selfFilter" key.
Hello.
Can you please share your current repository project?
Right now I'm facing an issue with FilterAction.merge
@Anonymous wrote:Yep, I've realised now thanks.
It turns out the answer was simply to use
visualhost.applyJsonFilter(advancedFilter, "general", "selfFilter", FilterAction.merge);
instead of
visualhost.applyJsonFilter(advancedFilter, "general", "Filter", FilterAction.merge);
This will filter the visual and not all the other visuals.
@Anonymous wrote:Yep, I've realised now thanks.
It turns out the answer was simply to use
visualhost.applyJsonFilter(advancedFilter, "general", "selfFilter", FilterAction.merge);
instead of
visualhost.applyJsonFilter(advancedFilter, "general", "Filter", FilterAction.merge);
This will filter the visual and not all the other visuals.
You need to add this to the top to import FilterAction
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.