10. Parameters in Power Query (and Other Kinds of Parameters)
10.3 Parameterising a File or Folder Path
Start with a problem
Ruhi built the bank-statement report on her laptop (C:\Users\Ruhi\Desktop\BankStatements). On Shraddha's laptop the refresh fails: path not found.
Explain simply
Put the path in a Text parameter FolderPath and write Folder.Files(FolderPath). When the files move, you change one value.
Show the data
Before: hard-coded paths
| Query | Source step |
|---|---|
| Bank Transactions | Folder.Files("C:\Users\Ruhi\Desktop\BankStatements") |
| Orders | File.Contents("C:\Users\Ruhi\Desktop\visuals_orders_apr_may_2026.csv") |
About this data: This table uses columns: Query, Source step. This table uses columns: Parameter, Ruhi's value, Shraddha's value, Rows after refresh. Values shown are the lesson examples already on this page (not a new dataset).
Fictional sample data. Practice file: bank_statements/Jan.xlsx, bank_statements/Feb.xlsx, bank_statements/Mar.xlsx, visuals_orders_apr_may_2026.csv (source: src/practice/).
Demonstrate
- Manage Parameters › New: Name
FolderPath, Type Text, Current valueC:\Users\Ruhi\Desktop\BankStatements. CreateOrdersFilethe same way for the CSV path. - Select Bank Transactions › click the Source step › look at the formula bar.
-
Replace the text path with the parameter name:
= Folder.Files(FolderPath)› Enter.Your result should look like this:
Bank Transactions preview Same 9 transaction rows (spend ₹15,996) -
In Orders, change the Source step to
File.Contents(OrdersFile).Your result should look like this:
Orders preview Same 8 orders (₹2,100) -
Shraddha: Home › Transform data › Edit parameters › FolderPath
D:\Finance\BankStatements› OK › Apply changes.
Show the result
Your result should look like this (fictional sample):
| Parameter | Ruhi's value | Shraddha's value | Rows after refresh |
|---|---|---|---|
| FolderPath | C:\Users\Ruhi\Desktop\BankStatements | D:\Finance\BankStatements | 9 transactions |
| OrdersFile | C:\Users\Ruhi\Desktop\visuals_orders_apr_may_2026.csv | D:\Finance\visuals_orders_apr_may_2026.csv | 8 orders |
Explain what happened
The query text no longer contains a path. At refresh, Power Query reads the parameter value and builds the source from it.
Explore further
- If you join a folder and a file name (
FolderPath & "\" & "Jan.xlsx"), decide whether the folder value ends with a backslash. - In the Service, parameters appear under the semantic model's Settings › Parameters.
Detailed reference for this lesson:
Parameter for a file path in Power Query with example — in 30 seconds
What: A parameter is a named value, such as a folder path, that many queries can use. Change it once and every query follows.
Why: A path like C:\Users\Ruhi\Desktop works only on Ruhi's laptop. With a parameter, Shraddha changes one value on her PC.
Tiny example: FolderPath = D:\Data. The files move to E:\Reports. Change FolderPath once and press Refresh.
Parameter for a file path in Power Query with example — 30 सेकंदात
काय: Parameter म्हणजे folder path सारखी एक नाव दिलेली value, जी अनेक queries वापरू शकतात. एकदा बदला, सगळ्या queries मागे येतात.
का: C:\Users\Ruhi\Desktop सारखा path फक्त Ruhi च्या laptop वर चालतो. Parameter असेल तर Shraddha तिच्या PC वर एकच value बदलते.
छोटं उदाहरण: FolderPath = D:\Data. Files E:\Reports मध्ये गेल्या. FolderPath एकदा बदला आणि Refresh दाबा.
Parameter for a file path in Power Query with example — 30 सेकंड में
क्या: Parameter folder path जैसी एक नाम वाली value है, जिसे कई queries इस्तेमाल कर सकती हैं. एक बार बदलिए, सारी queries साथ चलती हैं.
क्यों: C:\Users\Ruhi\Desktop जैसा path सिर्फ़ Ruhi के laptop पर चलता है. Parameter हो तो Shraddha अपने PC पर एक ही value बदलती है.
छोटा उदाहरण: FolderPath = D:\Data. Files E:\Reports में चली गईं. FolderPath एक बार बदलिए और Refresh दबाइए.
First look at the data (before → after):
Same before / after tables as text
Before — Hard-coded paths inside two queries
| Query | Source step |
|---|---|
| BankStatements | Folder.Files("C:\Users\Ruhi\Desktop\Bank") |
| Targets | Excel.Workbook(File.Contents("C:\Users\Ruhi\Desktop\Targets.xlsx")) |
Formula / click path
Home › Manage Parameters › New: FolderPath (Text) = D:\Data
Source = Folder.Files(FolderPath & "\Bank")
After — Both queries now use one parameter
| Query | Source step |
|---|---|
| BankStatements | Folder.Files(FolderPath & "\Bank") |
| Targets | Excel.Workbook(File.Contents(FolderPath & "\Targets.xlsx")) |
Do it step by step:
- Click Home › Manage Parameters › New Parameter.
- Name:
FolderPath. Type: Text. Current Value:D:\Data. Click OK. - Select the BankStatements query. Click its Source step.
- In the formula bar, replace the typed path with
FolderPath & "\Bank". - Do the same in Targets with
FolderPath & "\Targets.xlsx". - Test it: change FolderPath to a wrong folder. You see an error. Change it back and refresh.
एक-एक step करून बघा:
- Home › Manage Parameters › New Parameter वर click करा.
- Name:
FolderPath. Type: Text. Current Value:D:\Data. OK करा. - BankStatements query निवडा. तिच्या Source step वर click करा.
- Formula bar मध्ये type केलेल्या path च्या जागी
FolderPath & "\Bank"लिहा. - Targets मध्ये पण
FolderPath & "\Targets.xlsx"ने तसंच करा. - Test करा: FolderPath चुकीच्या folder ला बदला. Error दिसतो. परत बरोबर करा आणि refresh करा.
एक-एक step करके देखिए:
- Home › Manage Parameters › New Parameter पर click कीजिए.
- Name:
FolderPath. Type: Text. Current Value:D:\Data. OK कीजिए. - BankStatements query चुनिए. उसके Source step पर click कीजिए.
- Formula bar में type किए path की जगह
FolderPath & "\Bank"लिखिए. - Targets में भी
FolderPath & "\Targets.xlsx"से ऐसा ही कीजिए. - Test कीजिए: FolderPath को ग़लत folder पर बदलिए. Error दिखता है. वापस सही कीजिए और refresh कीजिए.
What you should see on screen after the steps (sample layout — fictional data, not a Microsoft screenshot).
Steps in Power BI
- Create
FolderPath(Text) with current valueC:\QuickCommerce\Blinkit\. - Select the Source step of the query built from a Folder (or Excel/CSV) and click the ⚙ gear icon next to it.
- In the Folder path box, click the ABC drop-down › Parameter › choose
FolderPath› OK. Many connector dialogs support this directly. - For a single file, concatenate in M:
File.Contents(FolderPath & "Products.xlsx").
Source = Folder.Files(FolderPath),
Products = Excel.Workbook(File.Contents(FolderPath & "Products.xlsx"), null, true)
Ravindra Bagale's Tip
Friends, many students parameterise the folder path but leave a trailing backslash in one value and not the other, so the combined path breaks. Decide on one convention (always end with "\") and test with both your development path and the shared path. Don't worry – after doing it two or three times, it becomes a habit.
Ravindra Bagale's Tip – मराठी
मित्रांनो, बरेच students folder path parameterise करतात पण एका value मध्ये शेवटी backslash ठेवतात आणि दुसऱ्यात नाही, त्यामुळे जोडलेला path तुटतो. एक convention ठरवा (नेहमी "\" ने शेवट) आणि तुमचा development path आणि shared path दोन्हीने test करा. घाबरू नका, दोन-तीन वेळा केलं की सवय होते.
Ravindra Bagale's Tip – हिंदी
दोस्तों, बहुत से students folder path को parameterise करते हैं पर एक value में आख़िर में backslash रखते हैं और दूसरी में नहीं, जिससे जुड़ा हुआ path टूट जाता है. एक convention तय करो (हमेशा "\" पर ख़त्म) और अपने development path और shared path दोनों से test करो. घबराओ मत, दो-तीन बार करने पर आदत हो जाती है.
Fix common mistakes
| Wrong result | Reason | Correction |
|---|---|---|
| Expression.Error: cannot convert Text to Binary | Used a folder path inside File.Contents | Folder.Files for folders, File.Contents for one file |
| File not found: …BankStatementsJan.xlsx | Missing backslash when joining text | Add "\" between folder and file name |
| Works in Desktop, fails in the Service | A local path needs a gateway | Use a gateway, or a SharePoint folder |
Practise independently
Practice task
Shraddha moves the folder to E:\Reports\Bank. What exactly does she click, and how many queries must she edit?
Hints
- Only the parameter value changes.
Solution
Home › Transform data › Edit parameters › FolderPath = E:\Reports\Bank › OK › Apply changes. She edits zero queries; the 9 rows (spend ₹15,996) refresh as before.
Think like a professional
Never ship a report whose source path contains a personal user name. A parameter plus a shared location is the minimum for team work.
Revision card