Description:
This function determines the sign of a number. Returns 1 if the number is positive, zero (0) if the number is 0, and -1 if the number is negative.
Syntax: SIGN (number)
Remarks
Example
The SIGN function can be used in any database where you want to ascertain the mathematical sign for any given number that has may be positive, negative or 0. This function determines the sign of the number that is given as a value to the function. The number specified as the parameter can be any positive or negative number or it may be "0" and the SIGN function will simply read the sign of the number and accordingly it will return the result of the function which is "-1" for a negative number, "1" for a positive number and "0" for the number "0".The SIGN function works differently for different parameters supplied to it, and therefore the result for a parameter is different depending on the number supplied to the function.
=SIGN (-2.15) |
-returns the SIGN of the value "-2.15" (-1) |
=SIGN (-90) |
-returns the SIGN of the value "-90" (-1) |
=SIGN (0) |
-returns the SIGN of the value "0" (0) |
=SIGN ("text") |
-returns the SIGN of the value "text" (0) |
Let us take the example of a cube in PowerOLAP which requires data that is the value for any given integer which is given as a value to the function. If in the same dimension in another member or in another dimension in another cube, you want to display the calculated SIGN for the number then it is appropriate to use the SIGN function to calculate the SIGN for the number given as the parameter. In this case we can write a formula in the cube in PowerOLAP to calculate the SIGN value for a number with the help of this function and write this value to another member that is supposed to hold this value as fact data or you can also write this value to a different dimension in a different cube.
The formula above writes values into the "NumFunctionValuesData" cube to the "SIGN" member in the NumFunctionValues dimension (data is at the intersection with the MathValue member of the Version dimension). This is done by calculating the SIGN for a given number based on the number parameter that is the input supplied to the function. The SIGN function takes this parameter, and simply read the sign for the given number value and the result is obtained by returning either -1 or +1 or 0 depending upon the given number Depending upon the number parameter, the result of this function will change automatically. The formula above calculates the SIGN for the number from any number given as a parameter to the member "Number1" and the result is returned by ascertaining the SIGN for that number. This resultant value is written to the SIGN member of the "NumFunctionValues" dimension.