Forum Discussion
Wrong syntax for IF
Hi everyone,
I am beginner on Power BI and I try to do a new colonne on my dataset.
I don't understand why my DAX syntaxe is not correct .
I try to use 2 differents fields on same table for déterminate a new name with this two.
I would use a SWITCH because I think it's better but it can't use 2 différents fields.
Territory = if([Market] = "Sport" && [Region DO] = OR ("CA";"WA"); "NorthWest";0)
Could you help me please ?
Thanks,
Alex
- Anonymous8 years ago
Hi A_Barny,
OR function is used to check multiple logical expressions and return true if one of these expressions can be achieved, I'd like to suggest you use 'in' keywords to instead.
Territory = IF ( [Market] = "Sport" && [Region DO] IN { "CA"; "WA" }; "NorthWest"; 0 )Regards,
Xiaoxin Sheng
1 Reply
- AnonymousNot applicable
Hi A_Barny,
OR function is used to check multiple logical expressions and return true if one of these expressions can be achieved, I'd like to suggest you use 'in' keywords to instead.
Territory = IF ( [Market] = "Sport" && [Region DO] IN { "CA"; "WA" }; "NorthWest"; 0 )Regards,
Xiaoxin Sheng