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
qwaszx55
Frequent Visitor

Filter using OR from 2 different tables.

I'm sure this is much easier than I'm experiencing but its crushing me at the moment.

 

I have a service contracts table with say "CompanyName,ContractNo,Status" and a servicecontractsitem table that has "Item,Enddate,EndReason"

 

All I want to do is filter the CompanyName column on a single report with "ServiceContract[Status]" = "Terminated" OR ServiceContractItem[EndReason] = "".

 

If it was AND I could just drag them to the report visual filters but it seems I have to write this one. 

 

Why in the world I can't figure out this simple filtering is beyond me but I've looked everywhere. I've tried calculated columns with a nested if statement and realized that must have been one of the ugliest ways to do it.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@qwaszx55,

In DirectQuery mode, create calculated columns using BILASolution's DAX in Report View, you can also get expected result.
1.JPG

Regards,
Lydia

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

 

We can merge two tables into one and then filter the dataset.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

How do you go about this in direct query mode? 

Anonymous
Not applicable

@qwaszx55,

In DirectQuery mode, create calculated columns using BILASolution's DAX in Report View, you can also get expected result.
1.JPG

Regards,
Lydia

BILASolution
Solution Specialist
Solution Specialist

Hi @qwaszx55

 

Try this...

 

First, create 2 calculated columns

 

Status = RELATED('Service Contract'[Status]) 
Status or Reason = IF(OR('Service Contract Item'[EndReason] = "";'Service Contract Item'[Status] = "Terminated");"Yes";"No") 

tabla.png

 

 

Second, use "Status or Reason" calculated column to filter.

 

resultado.png

 

 

I hope this helps

 

Regards

BILASolution

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 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