ERROR DAX Function
Raises a user specified error.
Syntax
Parameter | Attributes | Description |
---|---|---|
ErrorText |
The text of the error to be raised. |
Return values
The function does not return any value.
Remarks
This function stops the execution raising an error with the description provided as argument.
The ERROR function can be placed in a DAX expression anywhere a scalar value is expected.
Because ERROR does not define a data type, use CONVERT around ERROR to control the expected data type and avoid the variant data type of the resulting expression.
Examples
-- ERROR produces an error to inform the users about a calculation -- that needs to be aborted. DEFINE MEASURE Sales[Inflation Rate] = CALCULATE ( SELECTEDVALUE ( 'Rates'[InflationRate], CONVERT ( ERROR ( "Missing inflation rate" ), DOUBLE ) ), TREATAS ( VALUES ( 'Date'[Calendar Year Number] ), 'Rates'[Year] ) ) EVALUATE 'Rates' EVALUATE SUMMARIZECOLUMNS ( 'Date'[Calendar Year], "Rate%", [Inflation Rate] )
Related articles
Learn more about ERROR in the following articles:
-
Automatic time intelligence in Power BI
This article shows why building custom Date tables is preferable to using the automatic date/time handling capabilities of Power BI. » Read more
-
Using the SELECTEDVALUE function in DAX
This article describes how the SELECTEDVALUE DAX function simplifies the syntax required in many scenarios where you need to read a single value selected in the filter context. » Read more
Last update: Sep 14, 2023 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo, Pär Adeen
Microsoft documentation: https://docs.microsoft.com/en-us/dax/error-function