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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
DavidAnthony
Advocate I
Advocate I

How to Apply a Filter to a Specific Power BI Custom Visual Without Affecting Other Visuals?

Hi everyone,
I'm working on a Power BI custom visual and trying to implement a filter that only applies to my specific visual, without affecting other visuals on the same page. Below is the code I'm currently using to apply the filter:
 
const dataTarget = [{ table , column }];
const dataValues = [value];

try {
  let filter = {
    $schema: "https://powerbi.com/product/schema#tuple",
    filterType: 6,
    operator: "In",
    target: dataTarget,
    values: dataValues,
  };

  host.applyJsonFilter(
    filter,
    "general",
    "filter",
    powerbi.FilterAction.merge
  );
} catch (error) {
  console.error("Filter error:", error);
}
The issue is that when I apply this filter using host.applyJsonFilter, it affects all visuals on the page that share the same data source, not just my custom visual. I want the filter to be isolated to my visual only.
How can I modify my code or approach to ensure the filter only impacts my custom visual, leaving other visuals on the page unaffected? Any advice or examples would be greatly appreciated!
Thanks
1 ACCEPTED SOLUTION
v-echaithra
Community Support
Community Support

Hi @DavidAnthony ,

Thank you for reaching out to Microsoft Community.

Try local filtering inside your visual logic, where it filters data post dataView load, you must handle the filtering inside your visual logic, not through applyJsonFilter.

While building the visual, apply your own filtering logic to the dataView before rendering.

Refer this document for implementing Data view: Power BI Custom Visual Part 4 - Accessing the DataView - Shetland Data

If this post helps, please give us Kudos and consider marking it Accept as solution to assist other members in finding it more easily.

Regards,
Chaithra.

 

View solution in original post

5 REPLIES 5
v-echaithra
Community Support
Community Support

Hi @DavidAnthony ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

v-echaithra
Community Support
Community Support

Hi @DavidAnthony ,

We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

v-echaithra
Community Support
Community Support

Hi @DavidAnthony ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

v-echaithra
Community Support
Community Support

Hi @DavidAnthony ,

Thank you for reaching out to Microsoft Community.

Try local filtering inside your visual logic, where it filters data post dataView load, you must handle the filtering inside your visual logic, not through applyJsonFilter.

While building the visual, apply your own filtering logic to the dataView before rendering.

Refer this document for implementing Data view: Power BI Custom Visual Part 4 - Accessing the DataView - Shetland Data

If this post helps, please give us Kudos and consider marking it Accept as solution to assist other members in finding it more easily.

Regards,
Chaithra.

 

Thanks for your reply

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.