'Dynamic Parameter Query in Power Query Advanced Editor
Currently I am struggling with the following task.
I added Parameters into my excel list to just load a part of my data that contain the following parameters:
Parameter1 = Value
Parameter2 = Value
Parameter3 = Period of time
and added them into the advanced editor of Power Query:
#"Filtered Row" = Table.SelectRows(#"Changed Typ", each ([Column1] = Parameter1)),
#"Filtered Row1" = Table.SelectRows(#"Filtered Row", each ([Column2] = Parameter2)),
#"Filtered Row2" = Table.SelectRows(#"Filtered Row1", each ([Column]= Parameter3)),
This works fine for me. However, it would be nice to add following things:
Range of Values for Parameter 3, so that instead of only to be able to load just one period of data to load multiple or ranges of periods.
If i choose to let one parameter blank that it will automatically load the whole data of the parameter, as if i would have not chosen to use this parameter.
Solution 1:[1]
For multiple values, Parameters perhaps aren't the most suitable option. I would prefer to store my list of values within another query.
For example, assuming that other query is named Parameter1List and comprises a single-column table with header Parameter1:
#"Filtered Rows" = Table.SelectRows(
#"Changed Type",
each
if Parameter1List[Parameter1]{0} = null then
true
else
List.Contains(Parameter1List[Parameter1], [Column1])
)
The if statement checks whether the first entry in Parameter1List is empty: if so, all rows are returned; otherwise, Column1 is filtered according to the entries in Parameter1List.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jos Woolley |
