Power Query - Replicating select all in parameter cell value

mamclero

New Member
Joined
Oct 31, 2017
Messages
5
Hello,

I was wondering if someone could help with an issue I'm having with my parameter in Power Query. I've created a table in excel I want to be the parameter value, which I've referenced in the filter in Power Query. It works fine when I select one value, but is there a way to select multiple or all values for my query using just the cell? I've searched around and tried to find something, but haven't had much luck. Thanks in advance!

I'm using Excel 2016.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Something like this?

guestaccess.aspx


B1 is Named Range Parameter.

Query Parameter splits the parameter value into a table:

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Parameter"]}[Content],
    Splitted = Table.TransformColumns(Source,{{"Column1", each Text.Split(_,","), type list}}),
    #"Expanded Column1" = Table.ExpandListColumn(Splitted, "Column1"),
    #"Renamed Columns" = Table.RenameColumns(#"Expanded Column1",{{"Column1", "Select"}})
in
    #"Renamed Columns"

Query Input imports the Input table into Power Query:

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Input"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Id", Int64.Type}, {"SomeText", type text}})
in
    #"Changed Type"

Query Output filters the Input, unless the first parameter value = "All", in which case the entire Input is returned:

Code:
let
    Source = Input,
    #"Merged Queries" = Table.NestedJoin(Source,{"SomeText"},Parameter,{"Select"},"Parameter",JoinKind.Inner),
    #"Removed Columns" = Table.RemoveColumns(#"Merged Queries",{"Parameter"}),
    Result = if Table.FirstValue(Parameter) = "All" then Source else #"Removed Columns"
in
    Result
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top