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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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,215,360
Messages
6,124,492
Members
449,166
Latest member
hokjock

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