DAX: Make UDFs Accept Optional Params
Power BI
Jun 18, 2026 12:37 AM

DAX: Make UDFs Accept Optional Params

Master optional parameters in DAX user defined functions with default values for Power BI and Analysis Services

Key insights

  • DAX UDFs now support optional parameters by letting you assign a default expression in the function signature.
    Callers can omit that argument and DAX will use the default value automatically.
  • Syntax: define parameters with type hints and an optional "= DefaultExpression" right in the signature, for example a parameter written as ParameterName : Type = DefaultExpression.
    The function body follows the parameter list and runs using the provided or default values.
  • Rules: the default expression is evaluated only when omitted and it cannot reference other parameters of the same function.
    You can skip optional parameters by leaving an empty position or omitting trailing arguments.
  • Practical benefits: optional parameters let you write reusable logic with sensible defaults, improve readability by showing defaults in the signature, and reduce boilerplate in common calls.
  • Example: a function like AddNum with defaults for x and y can be called as AddNum(), AddNum(1), AddNum(,2), or AddNum(1,2).
    This shows how callers can supply none, one, or both arguments.
  • Caveats: avoid placing required parameters after the first optional one in practice, check type hints and passing modes, and note the feature may still be under preview; also you cannot pass real column references as substitute metadata, only expressions.

Power BI - DAX: Make UDFs Accept Optional Params

Keywords

DAX optional parameters, DAX user defined functions, optional arguments in DAX, DAX function default parameters, Power BI DAX optional parameters, DAX custom function optional args, DAX UDF optional parameter examples, writing optional parameters in DAX