Number.Sign is a Power Query M function that determines the sign of a given number, returning 1 for positive numbers, -1 for negative numbers, and 0 for zero. The function returns the sign of the input number or null if the input is null.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Number.Sign( number as nullable number ) as nullable number
Description
Returns 1 for if number
is a positive number, -1 if it is a negative number, and 0 if it is zero.
If number
is null, Number.Sign
returns null.
Examples
Determine the sign of 182.
// Output: 1
Number.Sign( 182 )
Determine the sign of -182.
// Output: -1
Number.Sign( -182 )
Determine the sign of 0.
// Output: 0
Number.Sign( 0 )
Related functions
Other functions related to Number.Sign are:
- Number.Abs
- Number.Combinations
- Number.Exp
- Number.Factorial
- Number.IntegerDivide
- Number.Ln
- Number.Log
- Number.Log10
- Number.Mod
- Number.Permutations
- Number.Power
- Number.Sqrt
