Logical.ToText

Logical

Converts a logical value to its text representation.

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

Syntax

Logical.ToText(logicalValue as nullable logical) as nullable text

Parameters

NameTypeRequiredDescription
logicalValuelogicalYesThe logical value to convert to text.

Return Value

textThe text string "true" or "false".

Remarks

Logical.ToText converts true to "true" and false to "false". This is useful when you need to include a logical value in a text concatenation or display a boolean column as human-readable text.

Examples

Example 1: Convert InStock logical to text

Table.TransformColumns(
    Table.SelectColumns(Products, {"ProductName", "InStock"}),
    {"InStock", each Logical.ToText(_), type text}
)
Result
ProductName
InStock
1Widget Atrue
2Gadget Btrue
3Widget Cfalse
4Gadget Dtrue
5Thingamajig Efalse

Compatibility

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