Number.From
NumberConverts a value to a number.
Syntax
Number.From(value as any, optional culture as nullable text) as nullable numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
value | any | Yes | The value to convert to a number. |
culture | text | No | A culture code (e.g., "en-US") that determines locale-specific parsing. |
Return Value
number — The 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 | |
|---|---|---|---|
| 1 | Widget A | TRUE | 1 |
| 2 | Gadget B | TRUE | 1 |
| 3 | Widget C | FALSE | 0 |
Example 2: Convert text to number
let
Result = Number.From("95000")
in
#table({"ParsedValue"}, {{Result}})Result
ParsedValue | |
|---|---|
| 1 | 95,000 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks