<!-- https://learnsql.cpetoday.com/functions/m/number-sign -->
# Number.Sign

Language: Power Query M
Category: Number
Syntax: Number.Sign(number as number) as number
Summary: Returns -1 for a negative number, 1 for a positive number and 0 for zero.
Returns: -1, 0 or 1.
Level: Beginner
Related: Number.Abs, Number.Round, Number.Mod, Number.IsNaN, Number.From

## What it does
Number.Sign reduces a number to its direction: -1 for negative, 0 for zero and 1 for positive. Finance teams use it to label a movement as an increase or a decrease, or to split a ledger into debits and credits in a report, without writing a long if statement.
## Syntax and arguments
- number: the value to test.
## Example
A cash flow report labels each movement as an inflow, an outflow or no movement, so the reader can see the direction of each line.

```powerquery
let
    Movements = #table(type table [Item = text, Amount = number],
        {{"Customer receipts", 45000}, {"Payroll", -18000}, {"Bank fees", 0}}),
    Labeled = Table.AddColumn(Movements, "Direction", each
        if Number.Sign([Amount]) = 1 then "Inflow"
        else if Number.Sign([Amount]) = -1 then "Outflow"
        else "None", type text)
in
    Labeled
```

Customer receipts is an inflow, Payroll is an outflow and Bank fees is labeled None, because its amount is zero. The amounts are not changed.
## Example: a second, different use
Multiply by the sign of a balance to convert a signed amount into a normal balance that is shown as a positive number for the reader.
## Things to watch
- Zero gives 0, so a line with no movement is not confused with an inflow.
- It returns a number, not a text label. Use an if statement to get words.
- Sign conventions differ between systems: some show expenses as positive. Check the convention before you label anything.
- Null is not a number, so clean nulls before you call it.
## In business terms
Cash flow statements, bank activity summaries and debit and credit reports all depend on the direction of each amount. Labeling direction in the query keeps the presentation honest about money coming in and going out.
