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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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?

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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