cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
anushavikram
Frequent Visitor

Filter the contents of a table based on parameter of type Query in Power Query

Hi, 

 

Im new to power query. Im trying to filter a table based on a list of values passed as parameter. 

Something like this. 

pic1.JPG

dolphin_code is generated from another table by taking distinct values of a column. Something like below. 

 

let
Source = Sql.Database("HOTEDWSQL01", "EDW_Reporting"),
dbo_dim_outlet = Source{[Schema="dbo",Item="dim_outlet"]}[Data],
#"Filtered Rows" = Table.SelectRows(dbo_dim_outlet, each ([is_orbit] = "No") and ([dolphin_code] <> null)),
dolphin_code1 = #"Filtered Rows"[dolphin_code],
#"Removed Duplicates" = List.Distinct(dolphin_code1)
in
#"Removed Duplicates"

 

 

I applied rthis parameter as a filter on a column of a different table. 

The M code genrated was like this. 

Table.SelectRows(#"Filtered Rows2", each Text.Contains([store_id], BranchCode))

 

I modified this to 

= Table.SelectRows(#"Filtered Rows2", each List.Contains([store_id], BranchCode))

so as to filter by all the values in paramter and not just currennt value. 

 

This gives me an error as below. 

pic2.JPG

 

Kindly help. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Filter the contents of a table based on parameter of type Query in Power Query

Hi @anushavikram ,

 

Please change the Suggested value to list of values to have a try. 

 

Capture.PNG

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

1 REPLY 1
Community Support
Community Support

Re: Filter the contents of a table based on parameter of type Query in Power Query

Hi @anushavikram ,

 

Please change the Suggested value to list of values to have a try. 

 

Capture.PNG

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors