Forum Discussion
How to filter 2 different columns using "OR" in Power BI Embedded with JS
const basicFilter = {
$schema: "https://powerbi.com/product/schema#basic",
target: {
table: "Store",
column: "Salesperson"
},
operator: "In",
values: [202],
filterType: models.FilterType.BasicFilter,
requireSingleSelection: true
}
Im using this type of filter when embedding a Power BI Report using JS API.
Now, I filter the column "Salesperson" only, from table "Store".
But now, I need to change this, I need to do this following logic:
Table: Store
Column: Salesperson
Values: [202]
OR
Table: Store
Column: Manager
Values: [202]
Because, the user = 202, has registers when he was "salesperson" and registers when he was "manager" and I need to show both results.
How can I achive this "OR" in Power BI Embedded API JS?
Hi gluizqueiroz ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you lbendlin for the prompt response.
You can apply an OR filter across two different columns in Power BI Embedded by using an Advanced Filter. Basic Filters only allow filtering one column at a time, but Advanced Filters support combining conditions with OR logic.
In your case, you would create one advanced filter that contains:
Condition 1: Store[Salesperson] = 202
Condition 2: Store[Manager] = 202
Logical operator: OR
When applied, the report will show all rows where the user is either a salesperson or a manager, without needing any changes to your data model or calculated columns.
4 Replies
- lbendlin
Super User
Create a calculated column [SalesPerson] & "|" & [Manager].
Use PATHCONTAINS with your search criteria.
- v-venuppu
Community Support
Hi gluizqueiroz ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you lbendlin for the prompt response.
You can apply an OR filter across two different columns in Power BI Embedded by using an Advanced Filter. Basic Filters only allow filtering one column at a time, but Advanced Filters support combining conditions with OR logic.
In your case, you would create one advanced filter that contains:
Condition 1: Store[Salesperson] = 202
Condition 2: Store[Manager] = 202
Logical operator: OR
When applied, the report will show all rows where the user is either a salesperson or a manager, without needing any changes to your data model or calculated columns.
- v-venuppu
Community Support
Hi gluizqueiroz ,
I wanted to check if you had the opportunity to review the information provided and resolve the issue..?Please let us know if you need any further assistance.We are happy to help.
Thank you.
- v-venuppu
Community Support
Hi gluizqueiroz ,
May I ask if you have resolved this issue? Please let us know if you have any further issues, we are happy to help.
Thank you.