Forum Discussion
Replacing multiple text values
- 3 years ago
You can use the DAX function SWITCH along with the CONTAINS function to check if the text field contains certain values and return different text based on the result.
Here is an example of how you can modify your formula to achieve this:
Column = SWITCH(
TRUE(),
CONTAINS('External Traffic'[Source Medium], "google / organic"), "Organic",
CONTAINS('External Traffic'[Source Medium], "Facebook / Paid"), "Paid",
"Other"
)This formula will check if the Source Medium field contains the string "google / organic" and return "Organic" if it does, then it will check if it contains the string "Facebook / Paid" and return "Paid" if it does, and finally it will return "Other" if none of the previous conditions are met.
You can use the DAX function SWITCH along with the CONTAINS function to check if the text field contains certain values and return different text based on the result.
Here is an example of how you can modify your formula to achieve this:
Column = SWITCH(
TRUE(),
CONTAINS('External Traffic'[Source Medium], "google / organic"), "Organic",
CONTAINS('External Traffic'[Source Medium], "Facebook / Paid"), "Paid",
"Other"
)
This formula will check if the Source Medium field contains the string "google / organic" and return "Organic" if it does, then it will check if it contains the string "Facebook / Paid" and return "Paid" if it does, and finally it will return "Other" if none of the previous conditions are met.