2.1.4. Creating and Modifying Parameters
💡 First Principle: Hard-coded values are promises that the world won't change: this server, this folder, this date. Parameters replace those promises with named, typed variables, so a single change (or a setting in the service) repoints the whole solution without editing every query.
Power Query parameters are created in the Power Query Editor via Manage Parameters > New Parameter. Each has a name, a description, a Required flag, a type (Text, Decimal Number, Date/Time, and so on), suggested values (Any value, a List of values, or values from a Query), and a current value. Once created, a parameter can replace a literal anywhere M accepts one: in a source step's server or database name, a file path, a filter value, or a URL.
Typical uses the exam draws on:
- Environment switching: a
ServerNameparameter lets the same report point at development, test, or production databases. After publishing, owners can change the parameter value in the service under the semantic model's settings, so no one has to re-edit and republish the .pbix. - Parameterized file paths: a
FolderPathparameter makes a folder-based import portable between colleagues' machines and the gateway path. - Row filtering: a
StartDateparameter limits the history loaded during development, then widens for production. - Incremental refresh: two Date/Time parameters named exactly RangeStart and RangeEnd filter a fact table's date column; Power BI then manages partitions so the service refreshes only recent data. (Configuration of the policy is covered with refresh in 5.1.4.)
- Templates: saving a .pbit (Power BI template) prompts the user for parameter values when opened.
Don't confuse these with field parameters and what-if parameters, which are model and report features created with DAX that let users switch the measure or dimension a visual shows, or slide a numeric value. Power Query parameters change what data loads; field and what-if parameters change what the report displays.
⚠️ Exam Trap: Incremental refresh requires the parameters to be named exactly RangeStart and RangeEnd and typed as Date/Time, and the filter step should fold to the source. Parameters with other names or a Date type won't enable the incremental refresh policy.
Reflection Question: Your team publishes the same report for three regional databases with identical schemas. Explain how a parameter reduces this to one .pbix, and what an owner changes in the service to switch a copy to a different region.