Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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 "This3" then "That3" else null
I know that this could easily be done with conditional or custom column, but for now I need to do it with DAX. Any suggestions How this could be done?
BR,
Jere
Hi @VahidDM & @Tanushree_Kapse
What I meant, is that "This1" is included in the column. For instance, if a column value is "This1is", DAX will return "That1". Similarly, if the value is "This1isnot" it will still return "That1", because the value CONTAINS "This1"
That is what I meant with CONTAINS, not equals (=).
Any suggestions?
Can you share a sample of your table after removing sensitive data here?
Appreciate your Kudo!!
Hi @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". 
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✌️!!
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.
Try this measure with IF:
Measure =
IF (
    [Column] = "This1",
    "That1",
    IF ( [Column] = "This2", "That2", IF ( [Column] = "This3", "That3", BLANK () ) )
)
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos✌️!!
Hi @jereaallikko ,
Try this DAX:
Measure= IF([Column]="This1","That",IF([Column]="This2","That2",IF([Column]="This3","That3")), BLANK())
Mark this as a solution, if I answered your question.
Kudos are always appreciated.
Thanks!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
            | User | Count | 
|---|---|
| 8 | |
| 5 | |
| 5 | |
| 4 | |
| 3 | 
| User | Count | 
|---|---|
| 24 | |
| 11 | |
| 10 | |
| 9 | |
| 8 |