<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Replacing multiple text values in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-multiple-text-values/m-p/3006152#M101724</link>
    <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Here is an example of how you can modify your formula to achieve this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column = SWITCH(&lt;BR /&gt;TRUE(),&lt;BR /&gt;CONTAINS('External Traffic'[Source Medium], "google / organic"), "Organic",&lt;BR /&gt;CONTAINS('External Traffic'[Source Medium], "Facebook / Paid"), "Paid",&lt;BR /&gt;"Other"&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;</description>
    <pubDate>Fri, 06 Jan 2023 15:55:22 GMT</pubDate>
    <dc:creator>gingerbread</dc:creator>
    <dc:date>2023-01-06T15:55:22Z</dc:date>
    <item>
      <title>Replacing multiple text values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-multiple-text-values/m-p/3006090#M101720</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to create a column that will display new text values. Below is the formula I've been using so far, but looking for something that would work using CONTAINS not EQUAL as there are over 2,000 distinct values. So, for example, if the text contains organic then return "Organic" if paid return "Paid".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Column = &lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'External Traffic'&lt;/SPAN&gt;&lt;SPAN&gt;[Source Medium]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"google / organic"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Organic"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'External Traffic'&lt;/SPAN&gt;&lt;SPAN&gt;[Source Medium]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Facebook / Paid"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Paid"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"Other"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I've found other solutions on this forum but it seems to be applying only to numerical values. Any help is much appreciated!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Jan 2023 15:33:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-multiple-text-values/m-p/3006090#M101720</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-06T15:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing multiple text values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-multiple-text-values/m-p/3006140#M101722</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Try using CONTAINS() or CONTAINSSTRING().&lt;BR /&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 15:53:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-multiple-text-values/m-p/3006140#M101722</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2023-01-06T15:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing multiple text values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-multiple-text-values/m-p/3006141#M101723</link>
      <description>&lt;P&gt;Hey&amp;nbsp;Anonymous&lt;/LI-USER&gt;,&lt;/P&gt;&lt;P&gt;You can use the SWITCH function to more easily handle multiple IF conditions at once.&amp;nbsp;For the contains condition, use the CONTAINSSTRING function. For instance:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Column =
SWITCH (
    TRUE,
    CONTAINSSTRING ( 'External Traffic'[Source Medium], "google / organic" ), "Organic",
    CONTAINSSTRING ( 'External Traffic'[Source Medium], "Facebook / Paid" ), "Paid",
    "Other"
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 15:53:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-multiple-text-values/m-p/3006141#M101723</guid>
      <dc:creator>Barthel</dc:creator>
      <dc:date>2023-01-06T15:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing multiple text values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-multiple-text-values/m-p/3006152#M101724</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Here is an example of how you can modify your formula to achieve this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column = SWITCH(&lt;BR /&gt;TRUE(),&lt;BR /&gt;CONTAINS('External Traffic'[Source Medium], "google / organic"), "Organic",&lt;BR /&gt;CONTAINS('External Traffic'[Source Medium], "Facebook / Paid"), "Paid",&lt;BR /&gt;"Other"&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 15:55:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-multiple-text-values/m-p/3006152#M101724</guid>
      <dc:creator>gingerbread</dc:creator>
      <dc:date>2023-01-06T15:55:22Z</dc:date>
    </item>
  </channel>
</rss>

