Forum Discussion
Using the SWITCH Command with brackets in the name doesn't work
Hello, I am using the SWITCH command to normalize some company names. For example:
Normalized = SWITCH([Company],
"International Business Machines", "IBM",
"Microsoft", "MSFT"
All is working well however, when I there is a bracket in the name it doesn't see it. For example:
Normalized = SWITCH([Company],
"Laboratory Corp. of America (Labcorp)", "LH")
In the filter cards it’s listed is a "Blank"
There is no error on the DAX command. Any suggestions?
The data source cannot be changed so I am left with the brackets.
4 Replies
- amitchandakSuper User
Anonymous , It should work , check for spaces
or try one of the two
Normalized = SWITCH([Company],
"Laboratory Corp. of America "(Labcorp")", "LH")or
Normalized = SWITCH([Company],
"Laboratory Corp. of America \(Labcorp\)", "LH")- AnonymousNot applicable
Thanks for the quick reply. Okay this is strange, neither work, however:
Laboratory Corp. of America "(Labcorp")", "LH") - this errors out the DAX
ERROR: The syntax for '(' is incorrect.
Using the backslash doesn't give me an error, but also doesn't change it and it still remains Blank in the filter cards.
However, I don't know if I copied something wrorg or PBI added it but when I add "LH" front the backslash works. For example this works:
"LH","Laboratory Corp. of America \(Labcorp\)", "LH")
Strange- but thank you!!
- v-luwang-msftCommunity Support
Hi Anonymous ,
I tried the dax you provided and it works.See the below:
Check that the contents of the table match exactly what is used in Dax. And could pls provide your pbix file ? Remember to remove the confidential information.
Wish it is helpful for you!
Best Regard
Lucien Wang
- v-luwang-msftCommunity Support
Hi Anonymous ,
Has your problem been solved, if so, please consider Accept a correct reply as the solution to help others find it.Best Regard
Lucien Wang