Value.FromText
ValueConverts a text value to a typed value based on its content.
Syntax
Value.FromText(value as any, optional culture as nullable text) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
value | any | Yes | The text value to convert. |
culture | text | No | A culture code (e.g., "en-US") that influences how the text is parsed. |
Return Value
any — A value interpreted from the text input. Numbers, dates, logicals, and other types are automatically detected.
Remarks
Value.FromText attempts to interpret a text string and convert it to the most appropriate typed value. It can detect numbers, dates, logicals, and other types from their text representation. An optional culture parameter controls locale-specific parsing rules for numbers and dates.
This function is useful when processing text-based data sources where all values arrive as text and need to be converted to their proper types.
Examples
Example 1: Parse various text values into typed values
let
TextValues = {"42", "true", "3.14"},
Parsed = List.Transform(TextValues, each Value.FromText(_)),
TypeNames = List.Transform(Parsed, each
if Value.Is(_, type number) then "number"
else if Value.Is(_, type logical) then "logical"
else "other"
)
in
#table(
{"InputText", "ParsedValue", "DetectedType"},
List.Zip({TextValues, List.Transform(Parsed, each Text.From(_)), TypeNames})
)Result
InputText | ParsedValue | DetectedType | |
|---|---|---|---|
| 1 | 42 | 42 | number |
| 2 | true | true | logical |
| 3 | 3.14 | 3.14 | number |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks