Text.Length
TextReturns the number of characters in a text value.
Syntax
Text.Length(text as nullable text) as nullable numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
text | text | Yes | The text value to measure. |
Return Value
number — The number of characters in the text.
Remarks
Text.Length returns the number of characters in a text value, including spaces and special characters. Returns null if the input is null.
Examples
Example 1: Get product name lengths
Table.AddColumn(
Table.SelectColumns(Products, {"ProductName"}),
"NameLength", each Text.Length([ProductName]), type number
)Result
ProductName | NameLength | |
|---|---|---|
| 1 | Widget A | 8 |
| 2 | Gadget B | 8 |
| 3 | Widget C | 8 |
| 4 | Gadget D | 8 |
| 5 | Thingamajig E | 13 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks