What Are Power Query Parameters in Power BI?
Power Query parameters are named, reusable values you define in Power Query Editor that can be referenced across multiple queries — letting you change a database server name, a file path, a date filter, or any other input in one place rather than editing every query individually. They are essential for building flexible, environment-aware data pipelines.
Why Use Query Parameters in Power BI?
- Environment switching: Use a parameter for the database server name so you can switch between dev, staging, and production without rewriting queries.
- Dynamic filtering: Let users or the refresh process pass a date, region, or threshold value that filters data at the source level — reducing load.
- Centralized maintenance: If 10 queries reference the same file path, updating the parameter updates all 10 at once.
How to Create a Parameter in Power Query
In Power Query Editor, click Home → Manage Parameters → New Parameter. Give it a name (e.g., ServerName), choose a type (Text, Number, Date, etc.), optionally set a list of allowed values, and assign a default/current value. The parameter then appears in the Queries pane and can be referenced in any M expression by name.
How to Use Power Query Parameters in a Query
Reference a parameter in M code by its name — e.g., if your parameter is called ServerName, use it in a connection string: Sql.Database(ServerName, “MyDatabase”). In the UI, you can also use Home → Data Source Settings and replace hard-coded values with the parameter name via the dropdown.
How to Use Power Query Parameters in Power BI — Step-by-Step Tutorial
This tutorial walks you through creating a Power Query parameter and using it to dynamically switch a database server name. You will finish in 4 steps and under 5 minutes.
Steps
Step 1: Create a parameter
In Power Query Editor, click Home → Manage Parameters → New Parameter. Name it ‘ServerName’, type: Text, Current Value: your dev server address (e.g., ‘dev-sql.company.com’). Click OK.
Step 2: Reference the parameter in your query
Open the query’s Advanced Editor. Find the line where the server name is hard-coded (e.g., Sql.Database(“dev-sql.company.com”, “SalesDB”)) and replace the string with the parameter name: Sql.Database(ServerName, “SalesDB”).
Step 3: Test with the current value
Click Close & Apply. The query uses the parameter’s current value. Verify data loads correctly.
Step 4: Switch environments
To point to production, go back to Manage Parameters and change ServerName’s current value to ‘prod-sql.c