Logical.FromText
LogicalConverts a text value to a logical (true/false).
Syntax
Logical.FromText(text as text) as nullable logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
text | text | Yes | A text value to convert. Must be "true" or "false" (case-insensitive). |
Return Value
logical — A logical value parsed from the text input.
Remarks
Logical.FromText converts the text strings "true" and "false" (case-insensitive) to their corresponding logical values. Any other text input raises an error. This is useful when importing data from text-based sources where boolean values are stored as strings.
Examples
Example 1: Parse text boolean values
let
Values = {"true", "false", "TRUE", "False"},
Results = List.Transform(Values, each Logical.FromText(_)),
TextResults = List.Transform(Results, each Text.From(_))
in
#table(
{"InputText", "AsLogical"},
List.Zip({Values, TextResults})
)Result
InputText | AsLogical | |
|---|---|---|
| 1 | true | true |
| 2 | false | false |
| 3 | TRUE | true |
| 4 | False | false |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks