Parameters and typed functions
Separate a configuration value from a function argument
A parameter is a named value used to configure a query, such as a minimum accepted quantity or a culture identifier. A reusable function is an expression that accepts inputs and returns a result. A query parameter can be passed to a function, but the function can also be invoked directly with different arguments. In the editor, Manage Parameters lets you create named parameters, choose a type and set the current value. A suggested list is a convenience for editing, not an authorization rule. In an Import model, changing a query parameter changes the query used on the next evaluation or refresh; it does not behave like a report slicer that filters already loaded rows. All snippets are standalone M expressions for a blank query in a disposable Desktop Import environment unless otherwise noted. Outputs are expected, not observed; native M execution and installed build are NOT RUN. Use the inline synthetic inputs; no external account, connection or folder permission is required.
Example 1: a typed threshold function
let Keep = (input as table, minimum as number) as table => Table.SelectRows(input, each [Qty] >= minimum), Source = #table(type table [ID=text, Qty=number], {{"A",1},{"B",3},{"C",5}}), Result = Keep(Source, 3)in ResultExpected rows: B/3 and C/5. Changing the second argument to 5 returns C only. The signature checks the broad table and number types; it does not establish that the table contains a Qty column, that every Qty is numeric or that the minimum is nonnegative. Check those business constraints separately. Use a parameter query named MinimumQty in place of the literal 3 only after creating it.
Example 2: transform records with a shared function
let Parse = (r as record, culture as text) as record => Record.TransformFields(r, {{"Qty", each Number.FromText(_, culture)}}), Inputs = {[ID="001", Qty="2"], [ID="002", Qty="4"]}, Results = List.Transform(Inputs, each Parse(_, "en-US"))in ResultsExpected list of two records: ID 001 with numeric Qty 2 and ID 002 with numeric Qty 4. IDs stay text. List.Transform invokes a function once per list item logically; this is not a promise of evaluation order or number of physical evaluations. A nonnumeric Qty produces an error; lesson three shows explicit rejection rather than replacing it with zero.
Choose the correct parameter boundary
A parameterized filter changes which rows qualify without choosing a different source. A dynamic source changes where data is obtained, for example a host or file location constructed during evaluation. Some dynamic sources cannot refresh in the Service; specific exceptions and connector rules must be checked against current documentation. Dynamic M query parameters are a distinct feature for supported DirectQuery scenarios, not ordinary Import slicers; do not assume every connector or source switch is supported. Never construct a URL, file path or native SQL statement from an untrusted label. Keep source identity fixed or use an approved allowlist and connector-supported binding. A parameter is not a place to store secrets.
Practice: change the threshold
Using example one, predict the rows and sum of Qty when minimum is 4, and explain why a report slicer is not equivalent to modifying the query parameter in an Import model.
Official reading
parameters · functions · recordtransform · dynamic · refresh