Forum Discussion
Anonymous
2 years agoNot applicable
Correct DAX syntax for using SWITCH and Contains together.
Hi All, New to the forum and Power Bi. I am currently trying to figure out how to classify various codes to Products in my query. The trick is that some codes are utilized expressly for a given p...
- 2 years ago
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
CONTAINSSTRING function (DAX) - DAX | Microsoft Learn
Expected result CC = SWITCH ( TRUE (), 'Code Load'[Billing ID] = "ESEAT3", "Seats", CONTAINSSTRING ( 'Code Load'[Billing ID], "EECI" ), "Superior Svc" ) - Anonymous2 years ago
Disregard my earlier send re useing CONTAINS in a nested statement. Your solution works PERFECTLY. Thanks for the quick response!!!
Jihwan_Kim
Super User
2 years agoHi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
CONTAINSSTRING function (DAX) - DAX | Microsoft Learn
Expected result CC =
SWITCH (
TRUE (),
'Code Load'[Billing ID] = "ESEAT3", "Seats",
CONTAINSSTRING ( 'Code Load'[Billing ID], "EECI" ), "Superior Svc"
)
- Anonymous2 years agoNot applicable
This looks very good. Question, how do i next the CONTAINSSTRING to utilize with multiple codes? Thanks.