Ravindra BagaleCourses & study guides

10. Power Query in Excel

10.8 Parameters

A parameter (बदलता येणारे मूल्य, जे अनेक ठिकाणी वापरता येते) stores a value such as a folder path or a minimum amount, used in several queries.

Steps in Excel – folder path parameter

  1. Home › Parameters › Manage Parameters › New Parameter.
  2. Name StatementFolder › Type Text › Current Value D:\Statements\SavingsAC\ › OK.
  3. Open the folder query's Source step (gear icon) › change Folder path to use the parameter (choose Parameter in the drop-down next to the box).
  4. When the folder moves, change only the parameter value (Manage Parameters) › Refresh.

Parameter from a worksheet cell (common Excel trick): put the value in a named cell MinAmount (e.g. 199). In Power Query: select that cell's Table/range › From Table/Range › right-click the value › Drill Down. Name the query pMinAmount, then filter Orders with each [Amount] >= pMinAmount. Users change the cell and click Refresh.

Ravindra Bagale's Tip

If you hard-code file/folder paths in the M code, all queries fail when you change laptops or move the folder – and many students then have to open every query. Keep the path in a parameter. And if you use a cell-based parameter, give it a clear label – "Change this and click Refresh".

Practice task

Create a StatementFolder parameter for the bank-statement query. Create a worksheet-cell parameter for a minimum order amount and use it to filter a query.