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

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

Reply
Anonymous
Not applicable

Filter a list of values OUT of my Query

Hello,

 

I'm looking to exclude 100's of values out of a column in my Query (UserID column) and am wondering the best way to do this. Every value in the UserID column is unique so manually filtering out would not be possible, and there is no other column where they will all have common values which I can filter on instead.

 

The data comes directly from a SQL database and I can't manipulate the data before it arrives in Power BI. 

 

I have a list of the UserIDs I need excluding which I can import as a CSV into PowerBI if I can utilise this.

 

Does anyone have any ideas?

 

Thank you in advance.

3 REPLIES 3
santiagomur
Resolver II
Resolver II

you can do after select the source data and enter the code to exclude the values you what.

 

Anotación 2019-10-23 170137.png

 

or in edit query filter the column with some conditional 

Anonymous
Not applicable

Hi @santiagomur ,

 

Thanks for the response but the problem is that I have 100's of values I want to exclude. I had considered both the options you have posed but don't want to have to tell the query editor / SQL database to exclude for example userid '00001' and '00019' and '00104' etc etc.... for 100's of values. 

 

Is there an easier way this can be done based on an existing list of userids I need excluding?

 

Thank you.

ImkeF
Community Champion
Community Champion

Hi @Anonymous 

you can write a parametrized query that dynamcally references your list like described here:

 

https://community.powerbi.com/t5/Desktop/Parameterized-SQL-Query-with-query-folding/td-p/171503

 

Just change to WHERE ... NOT IN..

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.