Every transformation we make in Power Query is recorded in the Applied Steps pane. Behind those steps, Power Query creates instructions in a language called M. That is what makes our transformations repeatable, but there is a catch: many of the values we select become hard-coded into those instructions.
If we filter a column for values greater than 50, that 50 becomes part of the code. To change the threshold to 80 or 100, we would normally need to open Power Query and edit the filter. That can become time-consuming and annoying very quickly.
Parameters let us change the values a query uses without rebuilding its transformations. For Excel users, we can even put those values in worksheet cells, change them there, and refresh the query.
What You'll Learn
- Use worksheet cells as query inputs by importing small tables and drilling down to individual values.
- Replace hard-coded filter values with query references, then refresh to apply updated worksheet inputs.
- Match input data types to filtered columns to help avoid errors.
- Create official parameters for dedicated features such as certain custom functions and Power BI incremental refresh.
Two Ways to Use Parameters in Power Query
There are two approaches worth understanding:
- Cell-based parameters: Values stored in Excel cells and brought into Power Query through separate queries.
- Official Power Query parameters: Parameters created inside the Power Query Editor using Manage Parameters.
Technically, the first approach does not create an official parameter. It creates a query that returns a single value, which another query can reference. However, it behaves like a parameter for our purposes, so calling it a cell-based parameter is a useful way to describe it.
I think cell-based parameters are often the most useful option for Excel users. The inputs remain on the worksheet, and refreshing the query applies the current cell values. Official parameters have additional features that matter for certain custom functions and incremental refresh in Power BI. We will work through both approaches.
Set Up the Sales Query
Our example uses an Excel table named SalesData, containing five columns:
- Date: The date of the sale.
- Customer: The customer name.
- Product: The product sold.
- Sold By: The salesperson.
- Value: The quantity sold, stored as a whole number.
Initially, we want a result containing only David’s sales for January 2019. Once that works, we will replace the fixed date and salesperson with worksheet inputs.
Import the data and set the data types
- Select a cell inside the
SalesDatatable. - Choose Data > From Table/Range to open the Power Query Editor.
- Select all the columns and choose Transform > Detect Data Type.
- If Date is detected as Date/Time, change it to Date. Choose Replace Current if prompted.
- Check that Customer, Product, and Sold By use Text, and Value uses Whole Number.
In this example, Value represents quantities that can only be whole numbers, so that data type is appropriate.
Apply the initial transformations
- Select the Date column and choose Transform > Date > Month > End of Month.
- Filter Date to include only January 31, 2019.
- Remove the Date column, as we do not need it in the final output.
- Filter Sold By to include only David.
- Remove the Sold By column as well.
Changing each sale date to its month-end date allows one date filter to select an entire month. Every January sale becomes January 31, every February sale becomes February 28 in 2019, and so on.
Selecting the filter steps reveals the fixed values in the formula bar. The date condition contains #date(2019, 1, 31), and the salesperson condition contains "David". These are the values we will make dynamic.
Choose Home > Close & Load > Close & Load To, then load the result as a Table on a New worksheet.
We now have David’s January 2019 sales, with only Customer, Product, and Value in the output. But what if we need Sally’s sales for March instead? Rather than editing the filters again, we can create two worksheet inputs.
Create Parameters from Excel Cell Values
1. Create two small input tables
On the output worksheet, create a date input and a salesperson input:
- In G2, enter the header Date, then enter March 31, 2019 in G3.
- In G5, enter the header Sold By, then enter Sally in G6.
Select G2:G3 and press Ctrl + T. Confirm that the table has headers, then use the Table Design tab to name the table Date.
Repeat this for G5:G6, naming the second table SoldBy. Each table should contain one header and one input value.
2. Turn the date input into a single-value query
- Select a cell in the Date input table.
- Choose Data > From Table/Range.
- Set the Date column’s data type to Date.
- Right-click the cell containing March 31, 2019, and select Drill Down.
Drill Down is the important step. Before drilling down, the query returns a table. Afterward, it returns the individual date value. That single value can be used directly in the sales query’s filter.
Matching the input’s data type to the column being filtered is a good way to avoid potential errors. Our sales query filters a Date column, so the input query should also return a Date value, not Date/Time or Text.
Choose Home > Close & Load > Close & Load To, select Only Create Connection, and click OK.
There is no need to load this value into another worksheet table. Its only purpose is to supply a value to the main query.
3. Turn the salesperson input into a single-value query
Repeat the same process for the SoldBy table:
- Select a cell in the SoldBy input table and choose Data > From Table/Range.
- Set the column’s data type to Text, matching the Sold By column in the sales data.
- Right-click the cell containing Sally and select Drill Down.
- Use Close & Load To and select Only Create Connection.
The Queries & Connections pane should now contain the main SalesData query and two connection-only queries: Date and SoldBy.
Replace the Hard-Coded Filters with Query References
Open the SalesData query again. We only need to change the values used by the existing filters, not recreate the transformations.
Make the date filter dynamic
- In Applied Steps, select the date filter step, named Filtered Rows in this example.
- In the formula bar, find
#date(2019, 1, 31). - Replace that entire date expression with
Date, the name of the single-value query. - Press Enter to apply the change.
The filter now compares the Date column with the value returned by the Date query. Power Query’s IntelliSense suggestions can help identify the query name as you type.
Make the salesperson filter dynamic
- Select the salesperson filter step, named Filtered Rows1 in this example.
- Find
"David"in the formula bar. - Replace the name, including its quotation marks, with
SoldBy. - Press Enter to apply the change.
Use the query reference, not a quoted text value. Leaving quotation marks around SoldBy would make it literal text rather than a reference to the input query.
Choose Home > Close & Load. The worksheet result now contains Sally’s sales for March 2019.
Test the Parameters with Refresh All
To check that the worksheet inputs control the result:
- Change the salesperson input from Sally to John.
- Change the date input to February 28, 2019.
- Choose Data > Refresh All.
The output updates to John’s sales for February 2019. No further filter edits are required inside Power Query.
Remember that the date input needs to match the transformation we applied. Because the sales dates were converted to month-end dates, use the relevant month-end date in the input table.
That is the whole cell-based method: create a few extra queries that return individual values, then reference their names in place of hard-coded values.
Create an Official Power Query Parameter
Cell-based inputs work well for worksheet-driven filtering, but Power Query also has dedicated parameter functionality.
Inside the Power Query Editor, choose Home > Manage Parameters, then click New.
For a salesperson parameter, use these settings:
- Name:
SoldBy2, to distinguish it from the existing cell-based query. - Description: Optional explanatory text.
- Type: Text.
- Suggested Values: List of values.
- Values: Sally, John, David, Mark, and Lucy.
- Default Value: Sally.
- Current Value: Sally.
Suggested values can be entered manually, as we are doing here. Alternatively, if an existing query returns a list, that query can supply the suggested values.
Click OK. The new parameter appears in the query list with a different icon. Selecting it displays a Current Value dropdown containing the names we entered.
To change its settings later, open Manage Parameters again. The same dialog lets us edit an existing parameter or create another one.
Use the official parameter in the sales query
Return to SalesData and select the salesperson filter step. Replace the SoldBy reference with SoldBy2.
The filter now uses the official parameter’s current value instead of the worksheet cell. Change the parameter’s Current Value selection, then return to SalesData to see the filtered result. Selecting Sally limits the result to Sally’s sales, while the date filter continues to use the cell-based Date query.
Once we replace SoldBy with SoldBy2 in that filter, changing the old salesperson worksheet input no longer controls it. The filter now gets its value from the official parameter.
Which Parameter Method Should You Use?
Use cell-based parameters when you want to control the query from an Excel worksheet. They make it straightforward to enter a new date or salesperson, refresh, and get a different result without reopening the editor.
Use official parameters when you need Power Query’s dedicated parameter features. These matter in scenarios such as certain types of custom functions and incremental refresh in Power BI. Ordinary cell-based queries do not have those special parameter features.
The same idea extends beyond this sales example. Parameters can filter data to a cost center or division, and they can also be used to change source files. If you use cell-based values to change sources, be aware that you may encounter a Formula Firewall error. That issue can be resolved, but it needs separate attention when designing the query.
The practical benefit is simple: keep the transformation logic in place and change the inputs that drive it. Whether those inputs live in worksheet cells or Manage Parameters, the result is a more flexible query with fewer repeated edits.


