<?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: Measure to count rows which contain multiple test strings in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-rows-which-contain-multiple-test-strings/m-p/3063952#M106017</link>
    <description>&lt;P&gt;this works perfectly. Thanks,&amp;nbsp;&lt;SPAN&gt;Binbin Yu!!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Feb 2023 13:51:49 GMT</pubDate>
    <dc:creator>stu3000</dc:creator>
    <dc:date>2023-02-06T13:51:49Z</dc:date>
    <item>
      <title>Measure to count rows which contain multiple test strings</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-rows-which-contain-multiple-test-strings/m-p/3061215#M105776</link>
      <description>&lt;P&gt;Dear PowerBI Community,&amp;nbsp;&lt;BR /&gt;I'm looking for a dax-measure that counts the rows of th comissions-table which contain multiple codes that I have selected with a slicer.&lt;/P&gt;&lt;P&gt;The result in this case would be "2"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;So far I have found the containsstrings command, but I don't know how to combine the selected codes&lt;/P&gt;&lt;P&gt;Do you have any advise?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 23:57:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-rows-which-contain-multiple-test-strings/m-p/3061215#M105776</guid>
      <dc:creator>stu3000</dc:creator>
      <dc:date>2023-02-03T23:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count rows which contain multiple test strings</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-rows-which-contain-multiple-test-strings/m-p/3061279#M105777</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="509556" data-lia-user-login="stu3000" class="lia-mention lia-mention-user"&gt;stu3000&lt;/a&gt; , Try a approch like this &lt;/P&gt;
&lt;P&gt;Power BI- Text Part slicer to filter/search text - &lt;A href="https://youtu.be/MKKWeOqFG4c" target="_blank"&gt;https://youtu.be/MKKWeOqFG4c&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 02:08:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-rows-which-contain-multiple-test-strings/m-p/3061279#M105777</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2023-02-04T02:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count rows which contain multiple test strings</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-rows-which-contain-multiple-test-strings/m-p/3062488#M105908</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your reply. It's a good approach, however I couldn't really solve the problem with it yet. Let me try to explain it better with the following example:&lt;/P&gt;&lt;P&gt;I have&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the "CodesTable" with all the necessary Codes, which is also the data for the slicer.&lt;/LI&gt;&lt;LI&gt;the CommissionsTable with the Commission Numbers and the Codes which are basically all in on Column. In real life it's a huge table which I actually don't want to change if possible.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;So far I have the following measure which works fine when only one code is selected:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;AffectedCommissions = &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;selectedcode&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;CodesTable[Codes]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;calculate&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;COUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;CommissionsTable[CommissionNo]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;CONTAINSSTRING&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;CommissionsTable[Codes]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;selectedcode&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, &lt;STRONG&gt;if more than one code is selected with the slicer, only the rows which contain the selected codes should be counted&lt;/STRONG&gt;. For example, if Codes 3, 4 and 5 are selected, then the result must be 2 (CommissionNo 3 and 6).&lt;/P&gt;&lt;P&gt;Furthermore, the Codes in the orders are not alway in the same order.&lt;BR /&gt;Is it possible to adjust the measure accordingly?&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 21:22:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-rows-which-contain-multiple-test-strings/m-p/3062488#M105908</guid>
      <dc:creator>stu3000</dc:creator>
      <dc:date>2023-02-05T21:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count rows which contain multiple test strings</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-rows-which-contain-multiple-test-strings/m-p/3063045#M105947</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="509556" data-lia-user-login="stu3000" class="lia-mention lia-mention-user"&gt;stu3000&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please try below steps:&lt;/P&gt;
&lt;P&gt;1. below is my test table&lt;/P&gt;
&lt;P&gt;Table1:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Table2:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2. create a measure with below dax formula&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _a =
    ADDCOLUMNS (
        'Table2',
        "Flag",
            IF (
                SUMX (
                    ADDCOLUMNS (
                        SELECTCOLUMNS ( 'Table1', "Selected", [Slicer] ),
                        "Max Codes", IF ( CONTAINSSTRING ( [Codes], [Selected] ), 1, 0 )
                    ),
                    [Max Codes]
                )
                    = COUNTROWS ( SELECTCOLUMNS ( 'Table1', "Selected", [Slicer] ) ),
                1,
                0
            )
    )
RETURN
    SUMX ( _a, [Flag] )
&lt;/LI-CODE&gt;
&lt;P&gt;3. add a slicer with field, add a cred visual with measure&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Please refer the attached .pbix file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Community Support Team_Binbin Yu&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;, then please consider&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 06:20:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-rows-which-contain-multiple-test-strings/m-p/3063045#M105947</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-06T06:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count rows which contain multiple test strings</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-rows-which-contain-multiple-test-strings/m-p/3063952#M106017</link>
      <description>&lt;P&gt;this works perfectly. Thanks,&amp;nbsp;&lt;SPAN&gt;Binbin Yu!!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 13:51:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-rows-which-contain-multiple-test-strings/m-p/3063952#M106017</guid>
      <dc:creator>stu3000</dc:creator>
      <dc:date>2023-02-06T13:51:49Z</dc:date>
    </item>
  </channel>
</rss>

