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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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