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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Filter where 'in' query editor

In power quey - is there a way to filter using something like the 'in' clause 

 

Eg instead of 

each [SNAPSHOT_DATE_KEY] = 20180916 or [SNAPSHOT_DATE_KEY] = 20180909 or [SNAPSHOT_DATE_KEY] = 20180902
or [SNAPSHOT_DATE_KEY] = 20180826 or [SNAPSHOT_DATE_KEY] = 20180819 or [SNAPSHOT_DATE_KEY] = 20180812 or [SNAPSHOT_DATE_KEY] = 20180805

 

it would be something like

each [SNAPSHOT_DATE_KEY] in ( 20180916 , 20180909 , 20180902, 20180826 , 20180819 , 20180812 , 20180805)

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I would expect something like one of these:

 

Table.SelectRows(FACT_RES_SUM_AGENT1, each List.Contains({20180916, 20180909, 20180902, 20180826, 201808019, 20180812, 20180805}, [SNAPSHOT_DATE_KEY])
Table.SelectRows(FACT_RES_SUM_AGENT1, each List.Contains({"20180916", "20180909", "20180902", "20180826", "201808019", "20180812", "20180805"}, [SNAPSHOT_DATE_KEY])

I've not put in any test data to run the code, so apologies if i've made any keying errors.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

I believe the command you are looking for is List.Contains

 

https://msdn.microsoft.com/en-us/query-bi/m/list-contains

Anonymous
Not applicable

Could you re-write this step in power query using that?

 

= Table.SelectRows(FACT_RES_SUM_AGENT1, each [SNAPSHOT_DATE_KEY] = 20180916 or [SNAPSHOT_DATE_KEY] = 20180909 or [SNAPSHOT_DATE_KEY] = 20180902
or [SNAPSHOT_DATE_KEY] = 20180826 or [SNAPSHOT_DATE_KEY] = 20180819 or [SNAPSHOT_DATE_KEY] = 20180812 or [SNAPSHOT_DATE_KEY] = 20180805 )

Anonymous
Not applicable

I would expect something like one of these:

 

Table.SelectRows(FACT_RES_SUM_AGENT1, each List.Contains({20180916, 20180909, 20180902, 20180826, 201808019, 20180812, 20180805}, [SNAPSHOT_DATE_KEY])
Table.SelectRows(FACT_RES_SUM_AGENT1, each List.Contains({"20180916", "20180909", "20180902", "20180826", "201808019", "20180812", "20180805"}, [SNAPSHOT_DATE_KEY])

I've not put in any test data to run the code, so apologies if i've made any keying errors.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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