Forum Discussion
How to Apply a Filter to a Specific Power BI Custom Visual Without Affecting Other Visuals?
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);
}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.
5 Replies
- v-echaithra
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.- DavidAnthony
Helper II
Thanks for your reply
- v-echaithra
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
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
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.