OpenBI Docs Buy

Number.IsNaN

true when a number is NaN, the "not a number" that zero divided by zero gives.

Group: Number. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Number.IsNaN(number as number) as logical
ParameterTypeDescription
numbernumberThe number to test.

Returns

logical. true for NaN, false for every other number, infinity included.

Remarks

  • NaN is not equal to anything, itself included, so x = Number.NaN never finds it: test with this function instead.
  • Dividing anything else by zero gives infinity, not NaN.

Examples

Zero divided by zero

Number.IsNaN(0 / 0)
true

Infinity is a number

Number.IsNaN(1 / 0)
false

Margins of shops with sales only

A shop with no sales and no profit gives 0 / 0.

let
    Margin = (profit, revenue) => profit / revenue
in
    List.Select({Margin(20, 100), Margin(0, 0), Margin(15, 60)}, each not Number.IsNaN(_))
{0.2, 0.25}

Number.From, List.Select.

Last updated · OpenBI Studio 0.3.79