Daily DAX : Day 388 CONTAINSSTRINGEXACT
CONTAINSSTRINGEXACT DAX Function in Power BI
The CONTAINSSTRINGEXACT function checks whether one text string contains another text string exactly (case-sensitive and whole-word match).
Syntax
CONTAINSSTRINGEXACT(<within_text>, <find_text>)
| Parameter | Description |
|---|---|
within_text |
The text string to search within (e.g., a column value). |
find_text |
The exact text to find (must match case and be a whole word). |
Return Value
Returns TRUE if find_text is found as an exact, case-sensitive, whole-word match within within_text. Otherwise, returns FALSE.
Note: Unlike
CONTAINSSTRING (which is case-insensitive and allows partial matches), CONTAINSSTRINGEXACT requires:
- Exact case matching
- Whole word matching (bounded by spaces, punctuation, or string ends)
Example
Exact Match Check =
CONTAINSSTRINGEXACT(Products[ProductName], "Pro")
| ProductName | CONTAINSSTRINGEXACT(..., "Pro") | Result |
|---|---|---|
| Laptop Pro | TRUE | Matches whole word "Pro" |
| Professional Camera | FALSE | "Pro" is part of "Professional" → not a whole word |
| pro edition | FALSE | Case mismatch ("Pro" vs "pro") |
| Pro Edition | TRUE | Exact case and whole word match |
Use Cases
- Exact keyword filtering in reports (e.g., flag products with exact model names like "Pro", "Lite", "Max")
- Case-sensitive tagging (e.g., distinguish "IT" department from "it" in text)
- Data quality checks – validate standardized text entries
- Conditional formatting or calculated columns based on precise text matches
Common Pitfalls
- Forgets that it's whole-word only – "Pro" won't match "Professional"
- Expects case-insensitivity – "pro" ≠ "Pro"
- Using instead of
SEARCHorFINDwhen position is needed
Best Practice: Use CONTAINSSTRINGEXACT when you need precise, standardized text detection in Power BI models.
Comments
Post a Comment