Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
Hi, I'm wanting to search for a particular pattern in a column (3 digits then 4 digits seperated by a dash) and return true / false if there's a match
for example: 123-4567 True A23-4567 False 000-8900 True
|
|
Solved! Go to Solution.
@Andybr maybe try something like this, add a new column:
Both Numbers =
VAR __left = IF ( IFERROR ( VALUE ( LEFT ( Match[Data], 3 ) ), -1 ) = -1, FALSE(), TRUE() )
VAR __right = IF ( IFERROR ( VALUE ( RIGHT ( Match[Data], 4 ) ), -1 ) = -1, FALSE(), TRUE() )
RETURN
IF ( __left && __right, TRUE(), FALSE() )
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Andybr maybe try something like this, add a new column:
Both Numbers =
VAR __left = IF ( IFERROR ( VALUE ( LEFT ( Match[Data], 3 ) ), -1 ) = -1, FALSE(), TRUE() )
VAR __right = IF ( IFERROR ( VALUE ( RIGHT ( Match[Data], 4 ) ), -1 ) = -1, FALSE(), TRUE() )
RETURN
IF ( __left && __right, TRUE(), FALSE() )
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Intrinsically, DAX isn't designed for the purpose of pattern check,
M might do the trick, but fairly verbose,
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQy1jUxNTNXitWJVnJE5hgYGOhaWBoYgDmWlrpmQABm6wIljIFAKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Data = _t]),
#"Added Custom" = Table.AddColumn(
Source,
"Chk_PQ",
each
let
l = Text.Split([Data], "-"),
chk1 = List.Count(l) = 2,
chk2 = (Text.Length(l{0}) = 3) and List.Accumulate(Text.ToList(l{0}), true, (s,c) => s and not (try Number.From(c))[HasError]),
chk3 = Text.Length(l{1}) = 4 and List.Accumulate(Text.ToList(l{1}), true, (s,c) => s and not (try Number.From(c))[HasError])
in
chk1 and chk2 and chk3
)
in
#"Added Custom"
Of coz, nothing is match for Regular Expression in this regard,
RegEx Check
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 63 | |
| 62 | |
| 42 | |
| 20 | |
| 18 |