Just recently noticed, that setting filters of PowerBI Embedded by using setFilters()
removes all but 1st filter from filters panel. However all the other filters are still returned when used getFilters()
. Tested in a few different environments. What may be wrong or is it some update from Microsoft?
report.getFilters().then(r => console.log(r))
produces:
[
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Regions",
"column": "Region"
},
"filterType": 1,
"displaySettings": {
"isLockedInViewMode": false,
"isHiddenInViewMode": false
},
"operator": "All",
"values": [],
"requireSingleSelection": false
},
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Hydrocarbon",
"column": "Hydrocarbon"
},
"filterType": 1,
"operator": "All",
"values": [],
"requireSingleSelection": true
}
]
However visually there is only "Regions" filter in filters panel.
Running this:
report.setFilters([
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Hydrocarbon",
"column": "Hydrocarbon"
},
"filterType": 1,
"operator": "All",
"values": [],
"requireSingleSelection": true
},
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Regions",
"column": "Region"
},
"filterType": 1,
"displaySettings": {
"isLockedInViewMode": false,
"isHiddenInViewMode": false
},
"operator": "All",
"values": [],
"requireSingleSelection": false
}])
Produces no errors, places "Hydrocarbon" to the 1st place in filters panel, hides "Regions" from filter panel.
report.getFilters().then(r => console.log(r))
then produces:
[
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Hydrocarbon",
"column": "Hydrocarbon"
},
"filterType": 1,
"operator": "All",
"values": [],
"requireSingleSelection": true
},
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Regions",
"column": "Region"
},
"filterType": 1,
"displaySettings": {
"isLockedInViewMode": false,
"isHiddenInViewMode": false
},
"operator": "All",
"values": [],
"requireSingleSelection": false
}
]
I have tried reverting whole project code to few months ago. Tried downgrading Microsoft PowerBI JS SDK 2.18.0 -> 2.8.1 and still the same.
So guess it is some "update" from Microsoft (which I can't find any mentions about) or the issue still on our side - some of our Reports setting...
report.updateFilters(models.FiltersOperations.Add, filters);
acts the same - visually appends only 1st filter from filters array, however calling getFilters()
produces twice as much filters as it was initially...
COLLAPSING/EXPANDING FILTERS PANEL MANUALLY (after setFilters/updateFilters) HELPS TO UN-HIDE DISAPPEARING FILTERS.
I will play around more to check if it has something to do with filterPaneEnabled
setting...