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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Query with Not In (select * from table)

Hello, I need to create report using query with multiple not in statements.

select email
from table1 a
where a.email not in ( select email from table2 )
and a.email not in ( select email from table3 )

and a.email not in ( select email from table4 )

 

Where table1, table2,  table3 and table4 are not related

Im using power bi with Direct Query mode.

 

Any ideas/help is greatly appreciated!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Based on my testing, please try the following methods again:

1.Create the simple tables.

vjiewumsft_0-1717723216711.png

vjiewumsft_1-1717723238367.png

vjiewumsft_2-1717723247718.png

vjiewumsft_3-1717723255853.png

2.Create the new table to filter the email.

filtered_data = 
var tab2 = SELECTEDVALUE(Table2[Email])
var tab3 = SELECTEDVALUE(Table3[Email])
var tab4 = SELECTEDVALUE(Table4[Email])
RETURN
CALCULATETABLE('Table1', NOT('Table1'[Email] IN {tab2, tab3, tab4}))

3.Drag the new table into the table visual. The result is shown below.

vjiewumsft_4-1717723263174.png

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

Based on my testing, please try the following methods again:

1.Create the simple tables.

vjiewumsft_0-1717723216711.png

vjiewumsft_1-1717723238367.png

vjiewumsft_2-1717723247718.png

vjiewumsft_3-1717723255853.png

2.Create the new table to filter the email.

filtered_data = 
var tab2 = SELECTEDVALUE(Table2[Email])
var tab3 = SELECTEDVALUE(Table3[Email])
var tab4 = SELECTEDVALUE(Table4[Email])
RETURN
CALCULATETABLE('Table1', NOT('Table1'[Email] IN {tab2, tab3, tab4}))

3.Drag the new table into the table visual. The result is shown below.

vjiewumsft_4-1717723263174.png

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello, sorry to take me so long to test your solution...

Unfortunately when i tried got this error - 

The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
Also, I can't open your pbix as we use older version...
Thank you any way, may be you know another way of doing that? Appreciate your help!!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.