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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello
How can I count cells in the matching below?
X*
*Y*Z*
i.e. cells that start with X and cells that contain both Y and Z in that order (first Y then Z).
The * is zero or any character
Thanks!
Solved! Go to Solution.
Hi @Anonymous ,
You can create a calculated column with using SEARCH function to to achieve it:
Count =
var _searchX= SEARCH("X",'Text'[Name],1,0)
var _searchY= SEARCH("Y",'Text'[Name],1,0)
var _searchZ= SEARCH("Z",'Text'[Name],1,0)
RETURN IF(_searchX=1||(_searchY>1&&_searchZ>1&&_searchY<_searchZ),1,0)
Best Regards
Rena
Hi @Anonymous ,
You can create a calculated column with using SEARCH function to to achieve it:
Count =
var _searchX= SEARCH("X",'Text'[Name],1,0)
var _searchY= SEARCH("Y",'Text'[Name],1,0)
var _searchZ= SEARCH("Z",'Text'[Name],1,0)
RETURN IF(_searchX=1||(_searchY>1&&_searchZ>1&&_searchY<_searchZ),1,0)
Best Regards
Rena
@Anonymous ,
Try a new column like
Column =
var _1 =SEARCH("Y",[Column],1,0)
var _2 =SEARCH("Z",[Column],1,0)
return
if(left([Column],1) = "X" && _1 >0 and _2 >_1,1,0)
Something with find expression and switch perhaps? Where you put some logic on whether you find an x and whether the found location comes earlier than the found location of y. And if y is not found, than there is only x.
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 |
|---|---|
| 56 | |
| 42 | |
| 41 | |
| 20 | |
| 19 |