FUNCTION DAX Statement


The FUNCTION keyword introduces a function definition (DEFINE) in a query (also known as query function).
The syntax after FUNCTION defines a function, which can be consumed in any other expression of the same query.
A query function overrides a model function with the same name. However, its definition is only used in other query measures and functions; other model measures and functions continue to use the model measure definition.
The following example shows using a query function in a DAX query.

DEFINE
FUNCTION SumTwoNumbers = ( 
    a : INT64 VAL, 
    b : INT64 VAL
) => a + b

EVALUATE
{
    SumTwoNumbers( 3, 2 )
}

-- Result is 5

 

Last update: Sep 15, 2025   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

2018-2025 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Passed by Expression

This parameter is passed by expression and can be evaluated multiple times in different evaluation contexts.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of FUNCTION? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.