Daily DAX : Day 451 ISSTRING
Power BI DAX Function: ISSTRING
The ISSTRING function in DAX checks whether a given value is of text (string) data type. It returns TRUE if the value is text, and FALSE otherwise.
Note: ISSTRING is an alias for the ISTEXT function. Both functions behave identically.
Syntax
ISSTRING(<value>)
Parameters
| Parameter | Description |
|---|---|
| <value> | The value or expression to check (can be a column reference, scalar value, etc.). |
Return Value
BOOLEAN: TRUE if the value is text/string, FALSE otherwise (including numbers, dates, blanks, etc.).
Example
EVALUATE
{
("Hello", ISSTRING("Hello")), // Returns TRUE
(123, ISSTRING(123)), // Returns FALSE
(DATE(2026,1,1), ISSTRING(DATE(2026,1,1))), // Returns FALSE
(BLANK(), ISSTRING(BLANK())) // Returns FALSE
}
Use Cases
- Data validation: Check if values in a column are actually text before performing string operations (e.g., concatenation, searching).
- Conditional logic: Apply different calculations based on data type, such as handling mixed-type columns safely.
- Error prevention: Avoid errors from functions like LEFT, SEARCH, or CONCATENATE when applied to non-text values.
- Dynamic measures/columns: Combine with IF to provide fallback values or messages when data is not text.
Sample Use Case in a Calculated Column
Safe Upper Case =
IF(
ISSTRING(Table[Column1]),
UPPER(Table[Column1]),
"Not Text"
)
This ensures UPPER is only applied to text values, returning a message otherwise.
Comments
Post a Comment