Number.From

Syntax

Number.From(value as any, optional culture as nullable text) as nullable number

About

Returns a number value from the given value. If the given value is null, Number.From returns null. If the given value is number, value is returned. Values of the following types can be converted to a number value:

  • text: A number value from textual representation. Common text formats are handled ("15", "3,423.10", "5.0E-10"). See Number.FromText for details.
  • logical: 1 for true, 0 for false.
  • datetime: A double-precision floating-point number that contains an OLE Automation date equivalent.
  • datetimezone: A double-precision floating-point number that contains an OLE Automation date equivalent of the local date and time of value.
  • date: A double-precision floating-point number that contains an OLE Automation date equivalent.
  • time: Expressed in fractional days.
  • duration: Expressed in whole and fractional days.
If value is of any other type, an error is returned.

Example 1

Get the number value of "4".

powerquery-mNumber.From("4")

4

Example 2

Get the number value of #datetime(2020, 3, 20, 6, 0, 0).

Number.From(#datetime(2020, 3, 20, 6, 0, 0))

43910.25

Example 3

Get the number value of "12.3%".

Number.From("12.3%")

0.123