By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
(For real projects & PL-300 exam prep)
Parameters in Power BI are variables you define to control queries, filters, or data sources dynamically. Dynamic data sources let you change connection details (e.g., server names, file paths, or API endpoints) without editing the PBIX file manually.
dev-sql
prod-sql
Sales_EU
Sales_US
You’re a BI analyst at a retail company. Your team maintains three identical reports (Dev, Test, Prod) that connect to different SQL databases. Every time a change is needed, you manually edit each PBIX file to point to the correct server. This is error-prone and unscalable.
Solution: Use parameters to dynamically switch between Dev-SQL, Test-SQL, and Prod-SQL with a single dropdown. Deploy one PBIX file, and let users (or the gateway) select the environment.
Dev-SQL
Test-SQL
Prod-SQL
ServerName
Param1
let
in
if
Text.Combine
Source = Sql.Database("prod-sql", "Sales")
Source = Sql.Database(ServerName, "Sales")
["Dev", "Test", "Prod"]
Create a report that connects to either Dev-SQL or Prod-SQL based on a parameter dropdown.
Text
List of values
["dev-sql.company.com", "prod-sql.company.com"]
dev-sql.company.com
Why?This creates a dropdown in your report to switch between servers.
SalesDB
Import
DirectQuery
powerquery-m let Source = Sql.Database("dev-sql.company.com", "SalesDB") in Source
powerquery-m let Source = Sql.Database(ServerName, "SalesDB") in Source
Why?Now the data source dynamically uses the ServerName parameter.
prod-sql.company.com
Why?Users can now switch environments without editing the PBIX file.
Why?Scheduled refreshes will now work dynamically.
Troubleshooting: - If refresh fails, check: - Gateway is online. - Credentials are correct for both servers. - Firewall allows connections from the gateway.
Dev
Test
Prod
prod-sql.typo.com
Trap: Hardcoding server names in each PBIX file.
M Query Syntax: "What’s the correct M syntax to reference a parameter named ServerName in a SQL query?"
Sql.Database(ServerName, "DatabaseName")
Trap: Forgetting to replace the hardcoded server name.
Gateway Configuration: "Your dynamic data source refresh fails in Power BI Service. What’s the most likely cause?"
Trap: Assuming credentials are the issue (they’re usually handled separately).
Parameter Types: "Which parameter type should you use to let users select from a list of environments?"
Create a Power BI report that: 1. Connects to two different Excel files (e.g., Sales_2023.xlsx and Sales_2024.xlsx).2. Uses a parameter dropdown to switch between them.3. Displays a table with data from the selected file.
Sales_2023.xlsx
Sales_2024.xlsx
Files to use: - Download Sales_2023.xlsx (placeholder).- Download Sales_2024.xlsx (placeholder).
FilePath
powerquery-m ["C:\Data\Sales_2023.xlsx", "C:\Data\Sales_2024.xlsx"]
powerquery-m let Source = Excel.Workbook(File.Contents(FilePath), null, true) in Source
Why it works: - File.Contents(FilePath) dynamically loads the file based on the parameter.- The slicer lets users switch files without editing the PBIX.
File.Contents(FilePath)
Home → Transform Data → Manage Parameters → New Parameter
Sql.Database(ServerName, "Database")
Excel.Workbook(File.Contents(FilePath))
Web.Contents("https://api.company.com/" & ApiEndpoint)
&
Home → Publish → Select workspace
Power BI Service → Settings → Datasets → Gateway connection
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.