We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi Guys,
im looking for a method to achieve the following.
I have 2 columns. the first colomn contains names (name) and the other colums countries (country).
Now im looking to make another (calculated) column which searches the column "name" for people who starting with the letters m to z and have the "country" USA and FR. For those "hits" i want the tekst in the column to be "YES". For people who starting with other letters and have the "country" USA and FR. For those "hits" i want the tekst in the column to be "YESSS". Al other combo's i want "NO".
Anyone familiair with tekstfunctions in DAX?
Solved! Go to Solution.
Hi @01_RAF_01
can you please try
if(Table[Country] in {'USA','FR'},
if(LEFT(Table[name],1) in {'m','n','o','p','q','r','s','t','u','v','w','x','y','z'},"YES","YESSS"),"NO")
Hi @01_RAF_01
I am not aware of any such pattern matching functionality on DAX.
When I had to do a similar job , I used R code in Power Query editor.
Hi @01_RAF_01 ,
You can try below code:-
Column =
VAR startswith =
LEFT ( Country_data[Name], 1 )
VAR result =
IF (
startswith
IN { "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" },
TRUE (),
FALSE ()
)
RETURN
IF (
result
&& Country_data[Country] IN { "USA", "FR" },
"Yes",
IF (
result = FALSE ()
&& Country_data[Country] IN { "USA", "FR" },
"YESSS",
"NO"
)
)Output:-
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi @01_RAF_01
can you please try
if(Table[Country] in {'USA','FR'},
if(LEFT(Table[name],1) in {'m','n','o','p','q','r','s','t','u','v','w','x','y','z'},"YES","YESSS"),"NO")
thanks @Anonymous it worked. I thought maybe there was a solution to look for the whole combination of letters without typing them all seperate. any idea if there is a solution for that?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 54 | |
| 37 | |
| 32 | |
| 17 | |
| 15 |
| User | Count |
|---|---|
| 64 | |
| 63 | |
| 37 | |
| 34 | |
| 22 |