The SIGN function returns the sign of a number or the result of a calculation.
SIGN(
number
)
- number: Real number or expression that returns a number.
The SIGN function returns an integer.
The SIGN function returns 1 if the value resulting from evaluating the argument passed to the function is positive, 0 if it is zero, and -1 if it is negative.
If we have created the measures Total sales, adding the sales amounts, and Total cost, adding the manufacturing costs, we can create the following measure that tells us whether the set of records with sales information involved in the current context have generated a benefit or not:
sign = SIGN([Total sales] - [Total cost])
We can see it in operation if we create a visualization that shows, for example, the list of products and the measure created: