Abs

Returns the absolute value of expression. The absolute value of a number is that number less its sign. A negative number becomes positive, while a positive number remains positive.

Syntax

Abs ( numeric_value_expression )
ParameterDescription

numeric_value_expression

Numeric value expression (see MDX Grammar Rules).

Example

The following example is based on the Demo Basic database. The absolute value is taken in case Variance is a negative number. Absolute Variance is always a non-negative number.

The following query:

WITH MEMBER
 [Scenario].[Absolute Variance]
AS
 'Abs([Scenario].[Actual] - [Scenario].[Budget])'
SELECT
 { [Year].[Qtr1].children }
ON COLUMNS,
 { [Scenario].children, [Scenario].[Absolute Variance] }
ON ROWS
FROM 
 Demo.Basic
WHERE
 ([Accounts].[Sales], [Product].[VCR], [Market].[San_Francisco])

returns the grid:

(axis)JanFebMar
Actual132312901234
Budget120011001100
Variance123190134
Absolute Variance123190134