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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
codjangmah
New Member

Passing Multiple Parameter filters in Power BI Embedded

I developed an MVC application and i am able to pass one parameter in a filter dynamically to PowerBI embedded which is working.

ie $filter={table1/column}. However I want to be able to pass multiple PBI tables and columns.

 

Is it possible in Power BI embedded and can it be passed dynamically? ie: $filter={table1/column1}&{table2/column2}..

8 REPLIES 8
piyush
Frequent Visitor

@codjangmah: One workaround can be to concatenate the two fields and pass it as a filter.

Can you please give an example and how will powerbi know how to process the filter you pass in if its concatenated?

you can do that using the PowerBI Javascript SDK

https://github.com/Microsoft/PowerBI-javascript

 

example: setting filters for three columns with multiple values:

 

filters1 = [{
"$schema": "http://powerbi.com/product/schema#advanced",
"target": {
"table": "Date",
"column": "Date"
},
"logicalOperator": "And",
"conditions": [{
"operator": "GreaterThan",
"value": "2014-04-11T21:00:00.000Z"
}]
}, {
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Department",
"column": "Department"
},
"operator": "NotIn",
"values": [
396,
395,
399
]
}, {
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Business Area",
"column": "Business Area"
},
"operator": "In",
"values": [
"R&D"
]
}]

report.setFilters(filters1)
.then(function(result) {
$("#result").html("Done.
" + JSON.stringify(result));
})
.catch(function(errors) {
$("#result").html("Error.
" + JSON.stringify(errors));
});

zq
Frequent Visitor

Hi alihamud, I have used the method described by you for filtering the report based on 2 columns from 2 different tables. However, combined these filterts not work whereas the separate filters work fine. Following is my code:

 

basicFilter = [

{
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "xyz",
column: "department_id"
},
operator: 'In',
values: [@ViewBag.DepartmentID]
},
{
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "abc",
column: "department_id"
},
operator: 'In',
values: [@ViewBag.DepartmentID]
}
]

 

If I only apply the filter for table xyz/abc, it works fine. It seems so that combining filters is an issue. Please help

you can use the JavaScript SDK

https://github.com/Microsoft/PowerBI-javascript

 

here is an example:

setting three filters on three column with multiple values:

 

filters1 = [
{
"$schema": "http://powerbi.com/product/schema#advanced",
"target": {
"table": "Date",
"column": "Date"
},
"logicalOperator": "And",
"conditions": [
{
"operator": "GreaterThan",
"value": "2014-04-11T21:00:00.000Z"
}
]
},
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Department",
"column": "Department"
},
"operator": "NotIn",
"values": [
396,
395,
399
]
},
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Business Area",
"column": "Business Area"
},
"operator": "In",
"values": [
"R&D"
]
}
]

report.setFilters(filters1)
.then(function (result) {
$("#result").html("Done.
" + JSON.stringify(result));
})
.catch(function (errors) {
$("#result").html("Error.
" + JSON.stringify(errors));
});

 

Thanks Allmud.. Very helpful guide.

Eric_Zhang
Microsoft Employee
Microsoft Employee

@codjangmah

 

It is impossible to pass more than one filter that way, as far as I know.
You can check the advanced filter in the newly released JS API, see Introducing the new Power BI JavaScript API.

Sad that this feature is pending from a long time and so many people are asking for this feature. I am wondering my Power BI team is not considering this request.

 

Anyway @Eric_Zhang Power BI Javascript is for only Power BI Embedded(azure service) or this can be used for integrating reports using Rest API using Power BI Embedded(azure service)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.