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
I want to create a new column where if Table[Animal] is equal to "Cat", "Dog", "Horse" assign "Four Legs" and for all other values, assign "Other"
What would the DAX look like?
So far I have:
Legs = 
SWITCH(
    TRUE (),
    'Table'[Animals] = "Cat", "4 Legs",
    'Table'[Animals] = "Dog", "4 Legs",
    'Table'[Animals] = "Horse", "4 Legs"
)
Solved! Go to Solution.
You can Another IF or use Switch like this:
Legs =
SWITCH (
    TRUE (),
    'Table'[Animals] = "Cat", "4 Legs",
    'Table'[Animals] = "Dog", "4 Legs",
    'Table'[Animals] = "Horse", "4 Legs",
    'Table'[Animals] = "New Condition", "Result",
    "Other"
)
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Hi,
But i would always recommend to have an index and use that.
Try this:
Legs = 
IF('Table'[Animals] in {"Cat","Dog","Horse"}, "4 Legs", "Other")
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
what if I have other conditons that I want to assign a specific value before I assign all remaining to "Other".
if condition 1:
  assign value 1
else if condition 2:
  assign value 2
else:
  assign value 3You can Another IF or use Switch like this:
Legs =
SWITCH (
    TRUE (),
    'Table'[Animals] = "Cat", "4 Legs",
    'Table'[Animals] = "Dog", "4 Legs",
    'Table'[Animals] = "Horse", "4 Legs",
    'Table'[Animals] = "New Condition", "Result",
    "Other"
)
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
@VahidDM is it possible to add another column value to look to determine the outcome using what you have on this topic?
I have two possible values for the Class Name column based on the Course Name and whether a student is in 7 or 8 grade.
 
					
				
				
			
		
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 | 
|---|---|
| 87 | |
| 49 | |
| 36 | |
| 31 | |
| 30 |