Stop 05 · M Language & Advanced Power QueryTopics · 4/8

Parameters in Power Query

Part of the Power BI Roadmap

In short

When the data folder moves from D:\Reports to a SharePoint path, you don't want to hunt through twenty queries. A parameter holds that value once, and every query reads it from there.

Parameters store values like a file path, server name or date that queries can reference, so you change them in one place.

The jaadu turns a single big dial on a wall panel while cooling fans in several small rooms of a dolls' house all change speed together.

Think of it like this

One thermostat for the whole house

Instead of adjusting every AC unit in every room, you set one central thermostat and all rooms follow it. A parameter is that thermostat: change the value in one place and every query using it follows.

Watch it happen

Changing one parameter

FolderPath
Sales query
Returns query

D:\Reports\

1/4The Sales query builds its file path from the parameter.

The big ideas

What you need to know

Manage Parameters

Home > Manage Parameters > New. Give it a name, a type like Text or Date, and a current value.

Use it by name

In code, a parameter is just a value: FolderPath & "sales.csv". Many dialogs also offer a Parameter option.

Dev and production

A ServerName parameter lets you switch from a test database to the live one without touching queries.

Change it after publishing

In the Power BI service, parameters can be edited in the semantic model settings without reopening Desktop.

See it in code

Walk through the code

powerquery
1// Parameters created in Manage Parameters:2//   FolderPath (Text)   = "D:\Reports\"3//   StartDate  (Date)   = #date(2025, 4, 1)4 5let6    Source = Csv.Document(File.Contents(FolderPath & "sales.csv"), [Delimiter = ","]),7    Promoted = Table.PromoteHeaders(Source, [PromoteAllScalars = true]),8    Typed = Table.TransformColumnTypes(Promoted, {{"OrderDate", type date}, {"Amount", type number}}),9    FromStart = Table.SelectRows(Typed, each [OrderDate] >= StartDate)10in11    FromStart

1/3The parameters live as their own small queries. Their current values are shown here as comments.

Two parameters drive the file location and the start of the financial year being loaded.

Save yourself the pain

Common mistakes

Oops

Typing the same server name or path into many queries.

Do this instead

Make one parameter and reference it everywhere, so a move means one edit.

Oops

Creating a parameter of type Any and then joining it to text.

Do this instead

Give parameters a proper type like Text or Date so steps and the service handle them correctly.

Your mission

Parameterise a file path

~15 min

Quick check

Why use a parameter for a database server name?

Go deeper

  1. 1Create a parameter for your data folder path.
  2. 2Swap between a test and real file by changing the parameter.
  3. 3Learn that parameters are also needed for incremental refresh.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge