Edit

Share via


FUNCTION

Introduces a function definition in a DEFINE statement of a DAX query.

Syntax

[DEFINE 
    (
      FUNCTION <function name> = ([parameter name] : [parameter type] [parameter subtype] [parameter passing mode], ...) => <function body>
    ) + 
]

(EVALUATE <table expression>) +

Parameters

Term Definition
function name The name of a function.
parameter name The name of the parameter. This cannot be a reserved keyword such as measure.
parameter type anyval, scalar, table or anyref. Anyval is an abstract type for scalar or table. Anyref is an abstract type for all references.
parameter subtype applies only to parameter type = scalar. Can be one of the following: boolean, datetime, decimal, double, int64, numeric, string, variant.
parameter passing mode val (eargerly evaluated) or expr (lazily evaluated).
function body A DAX expression for the function.

Return value

The calculated result of the function body.

Remarks