
New Member

February 5, 2020

….. I have WinSQL code that I’ve copied into Power Query (via advanced editor). This SQL code contains date criteria (across 9 individual queries) that I would like to control via a drop down in Excel.
I’m using this date table to lookup the SQL date nomenclature in each query based on the selection in the drop down list. I’ve then imported these 3 shaded tables into Power Query (in hopes of then using as parameters)
My problem after all this: I am unable to use these 3 date-related parameters in Power Query because I’ve copied SQL code into the editor rather than using M. Do you know of a way to Declare or call these parameters into this SQL-based advanced editor environment?


November 8, 2013

Hi Peter,
You can Setup a table in an excel sheet, with your parameters, dropdowns.
Let's say your table has 2 columns:
Parameter | Value |
Parameter One | 1 |
Parameter Two | 2 |
This table can be called from power query like this:
ParamTable = Excel.CurrentWorkbook(){[Name="Parameters"]}[Content]
In powr query, you can extract a parameter from this table with:
Parameter1 = Table.SelectRows(ParamTable, each ([Parameter] = "Parameter One"))[Value]{0} (there should not be duplicate items in the first column, but if there are, this code will take just the first match with {0})
1 Guest(s)
