Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a problem I have a strings something like below patterns:
A12345B, 12355, C56463D, A64631D,...
I want to create a simple column where I want to search for string that starts with A and ends with B and put 1 else 0? I would appreciate your help! I tried to use search and wildcards no luck!
Solved! Go to Solution.
Here is one way to do it, that looks for A and B anywhere in the string.
Has A and B =
If you need the match first/last, you can use this.
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi @Mekan ,
Here are the steps you can follow:
1. Create calculated column.
NEWCOLUMN =
var _A=IFERROR(
SEARCH("A",[ID]),-1)
var _B=IFERROR(
SEARCH("B",'Table'[ID]),-1)
var _len=LEN('Table'[ID])
return
IF(
_A=1&&_B=_len,1,0)
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Here is one way to do it, that looks for A and B anywhere in the string.
Has A and B =
If you need the match first/last, you can use this.
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Excellent, this is exactly what I wanted! I used your first/last solution and it worked perfectly! Thanks a lot for sharing! Have a great day!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |