10. Parameters in Power Query (and Other Kinds of Parameters)
10.3 Parameterising a File or Folder Path
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 करो. घबराओ मत, दो-तीन बार करने पर आदत हो जाती है.