CatchException
EAZYBI Evaluates an expression and returns an empty or specified value if the expression fails. This function prevents calculation errors from breaking the report when working with unexpected values or when using formulas that may reference non-existing members.
Syntax
CatchException(Value_Expression, [, Default_Value])
Arguments
Value_Expression | A valid MDX expression that you want to evaluate. If this expression runs successfully, its result is returned. |
---|---|
Default_Value | (Optional) The value to return if the Value_Expression fails. If this parameter is omitted, the function will return an empty value. |
Examples
Casting values to a different type
The formula below converts a string-type property to a numeric type; however, if an issue has some non-numeric characters in this field, the Cast function will return an error.
You can surround the formula with a CatchException function to prevent this error from disrupting the report.
CatchException( Cast([Measures].[Issue Budget] AS NUMERIC) )
Identifying the row preventing a measure from working
When creating and using a measure that, when enabled, causes the report to return an error, you can use the CatchException to identify which report row causes the issue.
In this example formula, the first parameter is the measure you've created, and the second parameter is a text that will be returned for the cell, where the calculation fails with an error.
CatchException( [Measures].[Calculated measure], 'causes error' )
See also
- Function Cast to convert a value to a different type.