Forum Discussion
jereaallikko
Helper III
5 years agoDAX with Multiple IF Contains Statements
Hi all, I am trying to figure out a simple DAX with multiple conditions: If [Column] contains "This1" then "That1" elseif [Column] contains "This2" then "That2" elseif [Column] contains "This...
jereaallikko
Helper III
5 years agoHi VahidDM
The table looks similar to this:
The "Country" Column is the one that I am trying to build with DAX. So when [Name] CONTAINS "FIN", it returns "Finland". Same goes with "GER", "Germany" & "RUS", "Russia".
VahidDM
Super User
5 years ago
Try this measure :
Country =
VAR _A =
MAX ( 'Table'[Name] )
RETURN
IF (
LEFT ( _A, 3 ) = "FIN",
"Finland",
IF (
LEFT ( _A, 3 ) = "GER",
"Germany",
IF ( LEFT ( _A, 3 ) = "RUS", "Russia", BLANK () )
)
)
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos✌️!!
- jereaallikko5 years ago
Helper III
This worked well! Thanks a lot.
Is there a way to apply similar solution to DAX column? This works in a DAX measure but if I want to use this as a slicer, it must be as a DAX column since DAX measures cannot be used as a slicer.