Number.From

Number

Converts a value to a number.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

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

Parameters

NameTypeRequiredDescription
valueanyYesThe value to convert to a number.
culturetextNoA culture code (e.g., "en-US") that determines locale-specific parsing.

Return Value

numberThe numeric representation of the value.

Remarks

Number.From converts a value of any type to a number. Text values are parsed as numbers (e.g., "123.45" becomes 123.45). Logical values return 1 for true and 0 for false. Pass a culture code when the text uses locale-specific formatting such as comma decimal separators.

If the value cannot be converted, an error is raised. This function is useful when importing data where numeric columns arrive as text.

Examples

Example 1: Convert logical InStock values to numbers

Table.AddColumn(
    Table.SelectColumns(Table.FirstN(Products, 3), {"ProductName", "InStock"}),
    "InStockNum", each Number.From([InStock]), type number
)
Result
ProductName
InStock
InStockNum
1Widget ATRUE1
2Gadget BTRUE1
3Widget CFALSE0

Example 2: Convert text to number

let
    Result = Number.From("95000")
in
    #table({"ParsedValue"}, {{Result}})
Result
ParsedValue
195,000

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks