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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
stevenamani
Advocate II
Advocate II

Filter Not Working (Javascript API)

I am using the Javascript API to embed a powerbi report however the filter is not affecting the result. The code is as follows:

 

function getFilters () {
const filter1 = {$schema: "http://powerbi.com/product/schema#basic",target: {table: "Users",column: "ID"},operator: "In",values: ["470"]};
var allFilters = [filter1];
return allFilters;
}

 

The above function is called from an updateEmbededDashboard function that contains

 

 report.getFilters()
                    .then(function(filters) {
                        
                        var allFilters = getFilters();

                        filters.push(allFilters);
                        
                        if (allFilters != null) return report.setFilters(allFilters);
                    }).catch (function (error) {
                        console.log(error.message);
                    });
1 ACCEPTED SOLUTION
stevenamani
Advocate II
Advocate II

In case anyone else comes accross this:

 

The issue was having the numeric value in double quotes. Instead of 

 

 

operator: "In",values: ["470"]};

It should be

operator: "In",values: [470]};

 

View solution in original post

1 REPLY 1
stevenamani
Advocate II
Advocate II

In case anyone else comes accross this:

 

The issue was having the numeric value in double quotes. Instead of 

 

 

operator: "In",values: ["470"]};

It should be

operator: "In",values: [470]};

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.