<?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: Count appearance of string in a comma-separated data column does not count values after the first co in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110794#M109865</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please explain exactly what is the problem?&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2023 16:09:19 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2023-03-03T16:09:19Z</dc:date>
    <item>
      <title>Count appearance of string in a comma-separated data column does not count values after the first co</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110546#M109847</link>
      <description>&lt;P&gt;I have two tables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Products&lt;/STRONG&gt; table has a single column with one product per field:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;List&lt;/STRONG&gt; table has several columns but the column I'm interested in has fields that can have as little as one product to as much as 17, all separated with a comma and no spaces in between:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue I'm facing and need help with is to correctly count each product either, ideally as as a measure. I tried two measures but they both gave me an incorrect count of blanks; there are no blank values either table.&lt;BR /&gt;What I found is that both measures count only the *first* value they find in the List column and then continue counting subsequent rows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I correctly count all values in each field from the List table and have zero "blank" counts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 14:32:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110546#M109847</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-03T14:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Count appearance of string in a comma-separated data column does not count values after the first co</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110595#M109849</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;Customer Products at M0 =&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( Products[Product] ),&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( Query1[M0_LIST] ),&lt;BR /&gt;INT ( CONTAINSSTRING ( Query1[M0_LIST], Products[Product] ) )&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 14:46:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110595#M109849</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-03T14:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Count appearance of string in a comma-separated data column does not count values after the first co</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110674#M109854</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the same product is repeated multiple times inside the string and you want to consider that in the counting then please use&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Customer Products at M0 =
SUMX (
    VALUES ( Products[Product] ),
    SUMX (
        VALUES ( Query1[M0_LIST] ),
        VAR String = Query1[M0_LIST]
        VAR Items =
            SUBSTITUTE ( String, ",", "|" )
        VAR Length =
            COALESCE ( PATHLENGTH ( Items ), 1 )
        VAR T1 =
            GENERATESERIES ( 1, Length, 1 )
        VAR T2 =
            SELECTCOLUMNS ( T1, "@Item", PATHITEM ( Items, [Value] ) )
        RETURN
            COUNTROWS ( FILTER ( T2, [@Item] = Products[Product] ) )
    )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Mar 2023 15:13:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110674#M109854</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-03T15:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Count appearance of string in a comma-separated data column does not count values after the first co</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110754#M109862</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;, thank you. I tried using the first measure and still gave me the incorrect counts, using the second one gave me this result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same product is not repeated inside the string, but two clients can definitely have the same products but they would be listed in different rows.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 15:44:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110754#M109862</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-03T15:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Count appearance of string in a comma-separated data column does not count values after the first co</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110794#M109865</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please explain exactly what is the problem?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 16:09:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110794#M109865</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-03T16:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Count appearance of string in a comma-separated data column does not count values after the first co</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110834#M109868</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;, with your second measure I got a count of 1 for each product:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, the List table contains blank values/rows too, and as for active relationships I see that the Product and Lists table are connected in the Product[Products] column and the List[M0_LIST] column, one to many relationship. I don't know if this is causing the issue and hope this gives more clarity to my issue.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 16:36:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110834#M109868</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-03T16:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count appearance of string in a comma-separated data column does not count values after the first co</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110875#M109874</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please delete or deactivate that relationship or use&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Customer Products at M0 =
CALCULATE (
    SUMX (
        VALUES ( Products[Product] ),
        SUMX (
            VALUES ( Query1[M0_LIST] ),
            INT ( CONTAINSSTRING ( Query1[M0_LIST], Products[Product] ) )
        )
    ),
    CROSSFILTER ( Query1[M0_LIST], Products[Product], NONE )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Mar 2023 17:00:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110875#M109874</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-03T17:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count appearance of string in a comma-separated data column does not count values after the first co</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110878#M109875</link>
      <description>&lt;P&gt;That was it! Thanks a lot&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 17:03:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-appearance-of-string-in-a-comma-separated-data-column-does/m-p/3110878#M109875</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-03T17:03:24Z</dc:date>
    </item>
  </channel>
</rss>

