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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Custom Slicer: applyJsonFilter not working after pbiviz package

Hello beforehand thanks for your help.

 

I am developing a custom calendar slicer, it already works as intended on developer mode at powerbi web. The problems is when I use pbiviz pakage and import the visual from file it doesn't filter the other visuals in the page, as it does in developer mode.

 

This is how I am building the filter and I have already added the filter property to capabilities.json.

 

 

this.host.applyJsonFilter(null, "dataPoint", "filter", FilterAction.merge);

const target: models.IFilterColumnTarget = {
      table: this.column.source.queryName.substr(0, this.column.source.queryName.indexOf('.')), // table
      column: this.column.source.displayName // col1
};

let conditions: models.IAdvancedFilterCondition[] = [];
if (data) {
      conditions.push({
          operator: "GreaterThanOrEqual",
          value: data[0].fecha.toDate().toJSON()
      });

      conditions.push({
           operator: "LessThanOrEqual",
           value: data[data.length - 1].fecha.toDate().toJSON()
      });
}

const filter = new models.AdvancedFilter(target, "And", conditions)
this.host.applyJsonFilter(filter, "dataPoint", "filter", FilterAction.merge);

 

 

I have also added this to the capabilities.json:

 

 

"objects": {
        "dataPoint": {
            "properties": {
               ...
                "filter": {
                    "type": {
                        "filter": true
                    }
                }
            }
       }
}

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks @V-lianl-msft, as shown the blog you shared the solution was on changing dataPoint to general, in capabilities.json and in every call of applyJsonFilter.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks @V-lianl-msft, as shown the blog you shared the solution was on changing dataPoint to general, in capabilities.json and in every call of applyJsonFilter.

V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please check your visual.ts and you could refer to this blog.

 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors