<?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 Mixing CONTAINSSTRING &amp;amp; IN keywords (dynamic number of values) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Mixing-CONTAINSSTRING-amp-IN-keywords-dynamic-number-of-values/m-p/2722559#M83083</link>
    <description>&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been trying to come up with a way to make CONTAINSSTRING &amp;amp; IN work together.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here is some context :&lt;/P&gt;&lt;P&gt;I have an SSRS text field where the user can enter multiple values with a ',' as delimiter.&lt;/P&gt;&lt;P&gt;The text or number of values typed in is totally up to the user and I can't use a dropdown list as there is too much value to display.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use that input as FILTER for my DAX query, something like that :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FILTER(
VALUES('Country'[_Country]),
CONTAINSSTRING('Country'[_Country], IN {"Fi", "Ja")
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would then get every result with Country being either Fiji, Finland, Jamaica or Japan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem that I face is obviously that CONTAINSSTRING expects 2 arguments, and I'm pretty new to DAX hence I don't know how to "format" the second argument to handle multiple values.&lt;BR /&gt;&lt;BR /&gt;I've seen a lot of answers using multiple CONTAINSSTRING statements with || operators but this cannot work since the input I get is dynamic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Aug 2022 08:31:52 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-08-24T08:31:52Z</dc:date>
    <item>
      <title>Mixing CONTAINSSTRING &amp; IN keywords (dynamic number of values)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Mixing-CONTAINSSTRING-amp-IN-keywords-dynamic-number-of-values/m-p/2722559#M83083</link>
      <description>&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been trying to come up with a way to make CONTAINSSTRING &amp;amp; IN work together.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here is some context :&lt;/P&gt;&lt;P&gt;I have an SSRS text field where the user can enter multiple values with a ',' as delimiter.&lt;/P&gt;&lt;P&gt;The text or number of values typed in is totally up to the user and I can't use a dropdown list as there is too much value to display.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use that input as FILTER for my DAX query, something like that :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FILTER(
VALUES('Country'[_Country]),
CONTAINSSTRING('Country'[_Country], IN {"Fi", "Ja")
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would then get every result with Country being either Fiji, Finland, Jamaica or Japan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem that I face is obviously that CONTAINSSTRING expects 2 arguments, and I'm pretty new to DAX hence I don't know how to "format" the second argument to handle multiple values.&lt;BR /&gt;&lt;BR /&gt;I've seen a lot of answers using multiple CONTAINSSTRING statements with || operators but this cannot work since the input I get is dynamic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 08:31:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Mixing-CONTAINSSTRING-amp-IN-keywords-dynamic-number-of-values/m-p/2722559#M83083</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-24T08:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Mixing CONTAINSSTRING &amp; IN keywords (dynamic number of values)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Mixing-CONTAINSSTRING-amp-IN-keywords-dynamic-number-of-values/m-p/2722968#M83113</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , Try like &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FIlter('Country', CONTAINSSTRING('Country'[_Country],"Fi") || CONTAINSSTRING('Country'[_Country],"Ja") )&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 10:20:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Mixing-CONTAINSSTRING-amp-IN-keywords-dynamic-number-of-values/m-p/2722968#M83113</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-08-24T10:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Mixing CONTAINSSTRING &amp; IN keywords (dynamic number of values)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Mixing-CONTAINSSTRING-amp-IN-keywords-dynamic-number-of-values/m-p/2723322#M83154</link>
      <description>&lt;P&gt;Sorry, maybe I didn't explained it clearly enough.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So this solution would work but those strings were just examples.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a real situation, the user will type the string values in a SSRS textbox which means I can't use this solution as I may retrieve one, two or maybe three values.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I can't work with hardcoded value basically&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":pensive_face:"&gt;😔&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 12:46:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Mixing-CONTAINSSTRING-amp-IN-keywords-dynamic-number-of-values/m-p/2723322#M83154</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-24T12:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Mixing CONTAINSSTRING &amp; IN keywords (dynamic number of values)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Mixing-CONTAINSSTRING-amp-IN-keywords-dynamic-number-of-values/m-p/2739901#M84157</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can try the following methods&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = FILTER(
VALUES('Country'[Country]),
CONTAINSSTRING('Country'[Country], "Fi*Ja*Ch")
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You retrieve one, two, or three values, and you can concatenate strings with "*".&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;You can use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;?&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;*&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;wildcard characters. Use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;~&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to escape wildcard characters.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/dax/containsstring-function-dax" target="_blank"&gt;CONTAINSSTRING function (DAX) - DAX | Microsoft Docs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 07:14:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Mixing-CONTAINSSTRING-amp-IN-keywords-dynamic-number-of-values/m-p/2739901#M84157</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2022-09-01T07:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Mixing CONTAINSSTRING &amp; IN keywords (dynamic number of values)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Mixing-CONTAINSSTRING-amp-IN-keywords-dynamic-number-of-values/m-p/2750189#M84824</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help &amp;amp; sorry for the delayed answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your solution but I don't think this is working. Because it seems to be searching for a word that starts with 'Fi', has 'Ja' in the middle of it &amp;amp; end with 'Ch' I think ?&lt;BR /&gt;&lt;BR /&gt;What I would need is something that consider evey single string independently.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An equivalent in SQL would be :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  WHERE Country LIKE '%Fi%' OR Country LIKE '%Ja%'&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;I'm wondering if it's even possible at this point.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 12:22:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Mixing-CONTAINSSTRING-amp-IN-keywords-dynamic-number-of-values/m-p/2750189#M84824</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-06T12:22:47Z</dc:date>
    </item>
  </channel>
</rss>

