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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
pbiembeded
Regular Visitor

Convert default AND to OR using Custom Visuals

I would like to create custom visuals to convert default AND to OR logical operator.


I am able to do this using DAX query.  https://www.sqlbi.com/articles/using-or-conditions-between-slicers-in-dax/

 

Do you know how I can achieve this by cresting custom visuals. Is there any existing slicer which will do for me ?

 

Is there any way in powerbi I can execute query by passing parameters through custom visuals ?

 

Like Entity Framework Or Ado.Net ?

3 REPLIES 3
dm-p
Super User
Super User

Hi @pbiembeded,

I'm not aware of an existing slicer for this.

You also can't supply custom queries via custom visuals - it's the combination of data roles, data view mapping (from capabilities) and any filters that you apply in the visual that get passed to Power BI for delegation. Power BI will determine what DAX to run.

The filtering APIs have the same functionality as the filter pane in the UI, so if you can generate the desired result in a visual manually using an advanced filter then you can use the Advanced Filtering API to generate an IAdvancedFilterCondition for each column and specify whether they should be an AND or an OR operation in the AdvancedFilterLogicalOperators property. This behaviour could then be wired up in a custom visual based on selections of displayed data values, to form a slicer, if you want this on the canvas rather then using the filter pane.

Good luck!

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




lbendlin
Super User
Super User

Don't have an answer but I am curious to learn about the use case.  To me this feels like a solution in search of a problem, and something that can potentially confuse the report users (as they may have different expectations).

Sure Thanks for response. Here is requirement.

Let's say we have 2 entity:

1. Profession
o Manager
o Lead
o Product Owner
o Business Analyst
o Developer
o Tester
2. Clients
o Walmart
o Costco
o BJ’s
o Target
o Best Buy
o Acme

Just sample data.
Profession = 'Developer' AND Client = 'Walamart'
Profession = 'Developer' OR Client = 'Walamart'

Year     Efforts(AND) Efforts(OR)

2007     104                1040  

2008     120                860

2009     56                   440

 

Using OR Query, I get efforts put by developer for all clients in Same report. But because of Power BI default behavior of AND I am not able to get the exact records.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors