<?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: Need help in calculated column - count function in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-calculated-column-count-function/m-p/3426905#M129873</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="616001" data-lia-user-login="MargusMartsepp" class="lia-mention lia-mention-user"&gt;MargusMartsepp&lt;/a&gt;&amp;nbsp;I have tried creating the calculated column using the DAX you've mentioned. I am getting wrong count as below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The first column is the calculated column which I have created using the dax you have mentioned.&lt;/P&gt;&lt;P&gt;Am i doing any thing wrong here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2023 17:39:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-09-12T17:39:26Z</dc:date>
    <item>
      <title>Need help in calculated column - count function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-calculated-column-count-function/m-p/3426872#M129860</link>
      <description>&lt;P&gt;Hello Everyone. So my requirement is to create a column - "Serial Number Count" in the matrix table. I have used the below dax in order to group by all the columns in the table but, the issue is, for few rows the count is coming correctly and for few rows the count is coming too high, which is wrong. For few of the wrong counts, the data is populated as the whole total from the table. I am attaching the screenshots below. Please refer them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using 2 different Dax's : (&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Serial Count =&lt;/SPAN&gt; &lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;agg_invent_serialid_chatbot&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;agg_invent_serialid_chatbot&lt;/SPAN&gt;&lt;SPAN&gt;[PRODUCT_NAME]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;agg_invent_serialid_chatbot&lt;/SPAN&gt;&lt;SPAN&gt;[INVENT_LOCATION_NAME]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;agg_invent_serialid_chatbot&lt;/SPAN&gt;&lt;SPAN&gt;[Config ID]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;agg_invent_serialid_chatbot&lt;/SPAN&gt;&lt;SPAN&gt;[ITEM_NUMBER]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"Serial Count"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;agg_invent_serialid_chatbot&lt;/SPAN&gt;&lt;SPAN&gt;[INVENT_SERIALID]&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;&lt;SPAN&gt;2)&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Serial Count =&lt;/SPAN&gt; &lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;agg_invent_serialid_chatbot&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;agg_invent_serialid_chatbot&lt;/SPAN&gt;&lt;SPAN&gt;[ITEM_NUMBER]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"Serial Count"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;agg_invent_serialid_chatbot&lt;/SPAN&gt;&lt;SPAN&gt;[INVENT_SERIALID]&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;Note - I am not sure which DAX is correct so that is why I have mentioned both of them.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Screenshot with correct count:&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Screenshot with wrong count:&lt;/P&gt;&lt;img /&gt;&lt;P&gt;The right count of this product is 221 but it is showing as 5232 which is the total of that product in the source.&lt;/P&gt;&lt;P&gt;How do I fix this?&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Any help would be much appreciated. Thank you so much in advance!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 11:20:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-calculated-column-count-function/m-p/3426872#M129860</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-13T11:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in calculated column - count function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-calculated-column-count-function/m-p/3426882#M129862</link>
      <description>&lt;P&gt;The DAX functions you're using, specifically &lt;STRONG&gt;SUMMARIZE&lt;/STRONG&gt;, are generally used to create new tables rather than calculated columns. This could be the reason why you're getting incorrect counts.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Use a Measure Instead of a Calculated Column&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Serial Count Measure = 
DISTINCTCOUNT(agg_invent_serialid_chatbot[INVENT_SERIALID])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;If you need a calculated column you could use:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Serial Count Column = 
COUNTROWS(
    FILTER(
        ALL(agg_invent_serialid_chatbot),
        agg_invent_serialid_chatbot[PRODUCT_NAME] = EARLIER(agg_invent_serialid_chatbot[PRODUCT_NAME]) &amp;amp;&amp;amp;
        agg_invent_serialid_chatbot[INVENT_LOCATION_NAME] = EARLIER(agg_invent_serialid_chatbot[INVENT_LOCATION_NAME]) &amp;amp;&amp;amp;
        agg_invent_serialid_chatbot[Config ID] = EARLIER(agg_invent_serialid_chatbot[Config ID]) &amp;amp;&amp;amp;
        agg_invent_serialid_chatbot[ITEM_NUMBER] = EARLIER(agg_invent_serialid_chatbot[ITEM_NUMBER])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:16:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-calculated-column-count-function/m-p/3426882#M129862</guid>
      <dc:creator>MargusMartsepp</dc:creator>
      <dc:date>2023-09-12T17:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in calculated column - count function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-calculated-column-count-function/m-p/3426905#M129873</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="616001" data-lia-user-login="MargusMartsepp" class="lia-mention lia-mention-user"&gt;MargusMartsepp&lt;/a&gt;&amp;nbsp;I have tried creating the calculated column using the DAX you've mentioned. I am getting wrong count as below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The first column is the calculated column which I have created using the dax you have mentioned.&lt;/P&gt;&lt;P&gt;Am i doing any thing wrong here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:39:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-in-calculated-column-count-function/m-p/3426905#M129873</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-12T17:39:26Z</dc:date>
    </item>
  </channel>
</rss>

