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 )| Parameter | Description |
|---|---|
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) | Jan | Feb | Mar |
|---|---|---|---|
| Actual | 1323 | 1290 | 1234 |
| Budget | 1200 | 1100 | 1100 |
| Variance | 123 | 190 | 134 |
| Absolute Variance | 123 | 190 | 134 |