Number.Sign

Updated on

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 )

Other functions related to Number.Sign are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/number-sign