Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
How to extract out of “Column Description” the alphanumeric ID that always starts with the letter P and is followed by 7 digits and put it in a separate column?
Column Description |
Charles has engaged on Project P5671223 with Peter |
with P8702345 the delivery succeeds to saint Paul and Mary |
together with others P9906123 was a success |
William and John knew about P8765439 |
Paul and Peter as well as Anne like the breeze P9908765 brings |
Solved! Go to Solution.
I couldn't do it with DAX, but if M code is okay then
= Text.Middle(Text.Select([Column Description], {"0".."9"}), Text.PositionOf(Text.Select([Column Description], {"P", "0".."9"}), "P")
New Column =
VAR _Description = Table[Column Description]
VAR _Pattern = "P\d{7}"
VAR _Match = REGEXMATCH(Table[Column Description], "P\d{7}")
VAR _ExtractedID = IF(_Match, REGEXEXTRACT(_Description, _Pattern), BLANK())
RETURN _ExtractedID
Thx for this proposal - took me a second to find out that this is R 🙂
I couldn't do it with DAX, but if M code is okay then
= Text.Middle(Text.Select([Column Description], {"0".."9"}), Text.PositionOf(Text.Select([Column Description], {"P", "0".."9"}), "P")
nice - quick & easy done.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 10 | |
| 9 | |
| 8 | |
| 6 | |
| 6 |
| User | Count |
|---|---|
| 24 | |
| 18 | |
| 16 | |
| 15 | |
| 9 |