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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
PowerBITesting
Helper IV
Helper IV

Add "or" condition between 2 fields belongs to two different entities ?

I am trying to filter in power bi desktop using 2 conditions, I have a report with Field 1 ,Field 2 and Field 3, would like to filter when Field1(table1) contains 1000   or field2 (table2) Contains 2000  or Field3 (table3) contains 3000.

 

PowerBITesting_0-1597145910194.png

I want to add filter condition ->

    Appointment has field A contains 1000  -OR

    Task has field B contains 2000 -OR

    Phone call has field C contains 3000

 

6 REPLIES 6
v-shex-msft
Community Support
Community Support

Hi @PowerBITesting,

AFAIk, power bi use 'AND' logic to link filter and the nested filter in calculating function.
If you want to achieve 'OR' filters, you may need to create an unconnected table as the source of filters, then use measure expression to extract and inaction with these selections.
Finally, you can use the measure at 'visual level filter' on your visuals to achieve the 'OR' filter effects.

If you confused about these operations, please share some dummy data then we can test to coding formula on it.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Since you are trying to use columns from different tables, Merging a dupliacte copy of the tables and writing a custom column using "List.Contains" function can do the trick. This will give you a "True" or "False" bifurcation for related rows which should serve the purpose.

 

Example : List.Contains({1460},[CREATED_BY_ID]) Or List.Contains({"Closed"},[CASE_STATUS]) OR
List.Contains({2434},[Count_of_closed"]))

where CREATED_BY_ID, CASE_STATUS and Count_of_closed are columns belonging to originally 3 different tables which were merged together for sake of this filtering.

 

amitchandak
Super User
Super User

@PowerBITesting , Can you share sample data and sample output in table format?

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

PowerBITesting_0-1597148056354.png

I need to calculate the number of activities WRT to Account . I need to apply filter for Appointment / task / phone call activites with OR condition. 

 

Below is matrix report.

step -1

-> I have a created a calulcated column as - Date Group = MONTH(activitypointers[createdon])&"-"&YEAR(activitypointers[createdon]) in activityPointer Table

Step -2   I have added Date Group as columns and count of Date Group as Values - which give the count of total of activities 

 

Step - 3 - I need to filter the data which has to be a OR condition Appointment / task / phone call activites. ?

Like Appointment (Filed 1 Contains "2000") or Phone call(Filed 3 Contains "2000") Or task(Filed 2 Contains "3000")

 

 

Account Name 01-01-202001-02-202001-03-202001-04-2020Count
Account1 10203040100
Account2 20102050100
Account3 30103040130

@PowerBITesting , As my initial thought we need to union some ids based on these two filters and then use them in finale calculation

https://docs.microsoft.com/en-us/dax/union-function-dax

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Try to create a column to use as condtion - But this is not working ( Formula is not correct)

-> Filed1 , Filed2 and Filed 3 are multiselct option sets

-> MeasureOrCheck = CALCULATE(COUNT(activitypointers[createdon]) ,OR(OR(Contains(appointments[Filed1], 100), Contains(tasks[Filed2], 200),Contains(phonecalls[Field3], 3000)) 

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!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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