SIGN DAX Function (Math and Trig)
Returns the sign of a number: 1 if the number is positive, zero if the number is zero, or -1 if the number is negative.
Syntax
Parameter | Attributes | Description |
---|---|---|
Number |
Any real number. |
Return values
The possible results are:
- 1 if the number is positive
- 0 if the number is zero
- -1 if the number is negative
Remarks
It does not work with infinite numbers.
Examples
-- ABS returns the absolute value of a number -- SIGN returns: -- +1 if the number is positive -- 0 if the number is zero -- -1 if the number is negative DEFINE VAR Vals = GENERATESERIES ( -2, +2, 0.5 ) EVALUATE ADDCOLUMNS ( Vals, "ABS", ABS ( [Value] ), "SIGN", SIGN ( [Value] ) ) ORDER BY [Value] DESC
Value | ABS | SIGN |
---|---|---|
2.00 | 2.00 | 1 |
1.50 | 1.50 | 1 |
1.00 | 1.00 | 1 |
0.50 | 0.50 | 1 |
0.00 | 0.00 | 0 |
-0.50 | 0.50 | -1 |
-1.00 | 1.00 | -1 |
-1.50 | 1.50 | -1 |
-2.00 | 2.00 | -1 |
Last update: Nov 14, 2024 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber
Microsoft documentation: https://docs.microsoft.com/en-us/dax/sign-function-dax