Forum Discussion

alexmcarreira's avatar
alexmcarreira
Frequent Visitor
6 years ago

Power BI JS not applying Visual filters correctly

Hello,

 

I'm currently facing an issue where the visual is loading with the filter applied. The label is correctly identifying the filter applied but the checkbox is not checked. (image below)

 

 

When I'm trying to get the filters using javascript I'm getting an error with the following error "Basic filter requires an operator (In | Not)"

 

This was working last week.

 

I've checked the open issues on Power BI Support and, currently, there is none with this issue.

 

As something changed on the API?

 

Thank you.

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi alexmcarreira 

    I am not aware of any recent changes to the filter structures (doesn't mean it hasn't happend) 🙂
    Are you able to share the filter object/code-structure that you are applying to your report?

    Cheers,
    Matt

    • alexmcarreira's avatar
      alexmcarreira
      Frequent Visitor

      Hello,

       

      This is the filter structure that I'm applying to the visual in question.

       

       

      [
      	{
      		"$schema": "http://powerbi.com/product/schema#basic",
      		"target": {
      			"table": "Product",
      			"hierarchy": "Product Hierarchy",
      			"hierarchyLevel": "Category"
      		},
      		"filterType": 1,
      		"displaySettings": {
      			"isHiddenInViewMode": false
      		},
      		"operator": "In",
      		"values": [
      			"Mix"
      		],
      		"requireSingleSelection": false
      	},
      	{
      		"$schema": "http://powerbi.com/product/schema#basic",
      		"target": {
      			"table": "Product",
      			"hierarchy": "Product Hierarchy",
      			"hierarchyLevel": "Segment"
      		},
      		"filterType": 1,
      		"displaySettings": {
      			"isHiddenInViewMode": false
      		},
      		"operator": "All",
      		"values": [],
      		"requireSingleSelection": false
      	},
      	{
      		"$schema": "http://powerbi.com/product/schema#basic",
      		"target": {
      			"table": "Product",
      			"hierarchy": "Product Hierarchy",
      			"hierarchyLevel": "Product"
      		},
      		"filterType": 1,
      		"displaySettings": {
      			"isHiddenInViewMode": false
      		},
      		"operator": "All",
      		"values": [],
      		"requireSingleSelection": false
      	},
      	{
      		"$schema": "http://powerbi.com/product/schema#basic",
      		"target": {
      			"table": "Sales",
      			"measure": "Total Sales"
      		},
      		"filterType": 1,
      		"displaySettings": {
      			"isHiddenInViewMode": false
      		},
      		"operator": "All",
      		"values": [],
      		"requireSingleSelection": false
      	},
      	{
      		"$schema": "http://powerbi.com/product/schema#basic",
      		"target": {
      			"table": "Sales",
      			"measure": "Total Sales (py)"
      		},
      		"filterType": 1,
      		"displaySettings": {
      			"isHiddenInViewMode": false
      		},
      		"operator": "All",
      		"values": [],
      		"requireSingleSelection": false
      	},
      	{
      		"$schema": "http://powerbi.com/product/schema#basic",
      		"target": {
      			"table": "Sales",
      			"measure": "% Sales Growth vs PY"
      		},
      		"filterType": 1,
      		"displaySettings": {
      			"isHiddenInViewMode": false
      		},
      		"operator": "All",
      		"values": [],
      		"requireSingleSelection": false
      	}
      ]

       

       

      Thanks.

      Alexandre Carreira