<?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: Distinct Count from different rows measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3716827#M144682</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="555045" data-lia-user-login="some_bih" class="lia-mention lia-mention-user"&gt;some_bih&lt;/a&gt;&amp;nbsp;tried that already but nothing will change, I believe that it will only count the distinct in the&amp;nbsp;'Medical Case'[Acct Src Id]&amp;nbsp; for every matching condition, for example if I will receive Sub_name = 123 it will count distinct for that particular row and then it will evaluate the second match and count again, so distinct count will not do my requirment in this case as it is counting for every match in the sub_name&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2024 10:30:57 GMT</pubDate>
    <dc:creator>Zakhamido</dc:creator>
    <dc:date>2024-02-22T10:30:57Z</dc:date>
    <item>
      <title>Distinct Count from different rows measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3716738#M144676</link>
      <description>&lt;P&gt;I need help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below function and the use of the function is to count the number of matching rows from one table if the table record is matching between the 2 tables, and every thing is working fine except for one thing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sometimes I will receive 2 rows from my data source for the same sub_name number which will mean that my function will count twice for every record I receive, and I want to let it count only distinct values for the Sub_name column to avoid duplication.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which means for example if I receive the record of Sub_name = 123, twice and the number of matching records is 2 I want it to display 2 instead of 4&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My function is as following&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUMX (
    ADDCOLUMNS (
        TIBCOINCIDENT_UPDATED,
        "__DCount",
            VAR CurrentSubName = TIBCOINCIDENT_UPDATED[SUB_NAME]
            VAR CurrentStatus = TIBCOINCIDENT_UPDATED[STATUS]
            VAR CurrentOutageTime = TIBCOINCIDENT_UPDATED[Outage_Time_UAE]
            VAR CurrentTime =
                NOW ()
            RETURN
                IF (
                    CurrentStatus = "Un-Planned Pending"
                        &amp;amp;&amp;amp; 'TIBCOINCIDENT_UPDATED'[Exceeded] = "No",
                    CALCULATE (
                        COUNT ( 'Medical Case'[Acct Src Id] ),
                        'Medical Case'[Substation] = CurrentSubName
                    )
                ) + 0
    ),
    [__DCount]
)&lt;/LI-CODE&gt;&lt;P&gt;Can any one help ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 09:51:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3716738#M144676</guid>
      <dc:creator>Zakhamido</dc:creator>
      <dc:date>2024-02-22T09:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count from different rows measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3716820#M144681</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;Try to replace&amp;nbsp;&lt;/P&gt;
&lt;PRE class=""&gt;&lt;CODE&gt; COUNT ( 'Medical Case'[Acct Src Id] )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;with&lt;/P&gt;
&lt;P&gt;DISTINCTCOUNT ( 'Medical Case'[Acct Src Id] ),&lt;/P&gt;
&lt;PRE class=""&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="595158" data-lia-user-login="Zakhamido" class="lia-mention lia-mention-user"&gt;Zakhamido&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 10:24:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3716820#M144681</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2024-02-22T10:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count from different rows measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3716827#M144682</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="555045" data-lia-user-login="some_bih" class="lia-mention lia-mention-user"&gt;some_bih&lt;/a&gt;&amp;nbsp;tried that already but nothing will change, I believe that it will only count the distinct in the&amp;nbsp;'Medical Case'[Acct Src Id]&amp;nbsp; for every matching condition, for example if I will receive Sub_name = 123 it will count distinct for that particular row and then it will evaluate the second match and count again, so distinct count will not do my requirment in this case as it is counting for every match in the sub_name&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 10:30:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3716827#M144682</guid>
      <dc:creator>Zakhamido</dc:creator>
      <dc:date>2024-02-22T10:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count from different rows measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3716942#M144692</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="595158" data-lia-user-login="Zakhamido" class="lia-mention lia-mention-user"&gt;Zakhamido&lt;/a&gt;&amp;nbsp;not enought info for some detailed reply, as model is not availabe, but do you need then COUNTX instead of SUMX if calculation logic is as you described.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 11:15:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3716942#M144692</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2024-02-22T11:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count from different rows measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3716968#M144697</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="555045" data-lia-user-login="some_bih" class="lia-mention lia-mention-user"&gt;some_bih&lt;/a&gt;&amp;nbsp;I think it is better if I will explain my requirements in details so you can thankfully advise me on the approach,&lt;/P&gt;&lt;P&gt;I have 2 tables one in direct query and the other in import mode&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first table is called TibcoIncident which is for outage affected substations data and the other table is called Medical Case which will have all the customers that is registered that Have a critical medical devices, now I want for every record to come in the TibcoIncident Table to check if this substation is available in the table 'Medical Case' and then count the number of affected customers from that table and then display the number of the measure in card&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I am able to fulfil my requirment with the function I mentioned but I am having an issue where sometimes I will receive a duplicate rows in the table TibcoIncident (can't be fixed at the moment) my function will count the matched customers twice as I do have 2 rows and I can't remove duplicates in the power query editor due to other requirements&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is to count distinct Sub_name when the conditions match&lt;/P&gt;&lt;P&gt;Thanks again for helping&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 11:30:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3716968#M144697</guid>
      <dc:creator>Zakhamido</dc:creator>
      <dc:date>2024-02-22T11:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count from different rows measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3717036#M144701</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="595158" data-lia-user-login="Zakhamido" class="lia-mention lia-mention-user"&gt;Zakhamido&lt;/a&gt;&amp;nbsp;I am not against creating measure for your issue, but did you try to make some transformation like, creating&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;TibcoIncident (can't be fixed at the moment) distinct per this part?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And later in Customer table connect this info and at end create measure.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 12:00:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3717036#M144701</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2024-02-22T12:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count from different rows measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3717177#M144706</link>
      <description>&lt;P&gt;I am sorry , I didn't get your suggestion could you please clarify ?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 13:13:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3717177#M144706</guid>
      <dc:creator>Zakhamido</dc:creator>
      <dc:date>2024-02-22T13:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count from different rows measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3717952#M144754</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="595158" data-lia-user-login="Zakhamido" class="lia-mention lia-mention-user"&gt;Zakhamido&lt;/a&gt;&amp;nbsp;did you think in model wise approach to connect tables and in one table add as calculated column data from other table ( if possible)?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 18:34:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-from-different-rows-measure/m-p/3717952#M144754</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2024-02-22T18:34:59Z</dc:date>
    </item>
  </channel>
</rss>

