Data Source Parameters

Parameters are special M queries that do not access an external data source and only return a scalar or individual value, such as a specific date, number, or string of text characters. The primary use case for parameters is to centrally define a common and important value, such as a server name or the name of a database, and then reference that parameter value in multiple other queries. Like global variables, parameters improve the manageability of large datasets as the dataset designer can simply revise a single parameter's value rather than manually modify many queries individually. 

Query parameters can be created and modified via the Manage Parameters dialog available on the Home tab of the Power Query Editor. The following image of Manage Parameters identifies the six parameters defined for the SQL Server database and the Microsoft Excel workbook:

Manage Parameters in Power Query Editor

For this dataset, development and production environment database parameters (for example, ProdServer and ProdDB) are configured with a list of valid possible values to make it easy and error-free when switching data sources. For the same purpose, both the name of the Excel workbook containing the annual Sales and Margin Plan and its file directory are also stored as parameters.

The Suggested Values dropdown provides the option to allow any value to be entered manually, for a value to be selected from a hardcoded list of valid values, and for a query that returns a list (a value type in M, such as a table and a record), to dynamically populate a list of valid parameter values. Given the small number of valid server names in this example and the infrequency of changing production and development server names, the three suggested values have been entered manually.

Parameters are often used with Power BI Template (.PBIT) files to enable business users to customize their own reports with pre-defined and pre-filtered queries and measures. For example, the user would open a template and select a specific department, and this selection would be used to filter the M queries of the dataset.

Additionally, parameters can be useful in defining the values used in the filtering conditions of queries, such as the starting and ending dates and in the calculation logic used to create custom columns in M queries. Parameters are usually only used by other queries and thus not loaded (gray font) but they can be loaded to the data model as individual tables with a single column and a single row. If loaded, the parameters can be accessed by DAX expressions just like other tables in the model. 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.12.140