<?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 if relating to a specific service in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-relating-to-a-specific-service/m-p/2251519#M54219</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="310221" data-lia-user-login="elinevans" class="lia-mention lia-mention-user"&gt;elinevans&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a measure to count the clients for&amp;nbsp;&lt;SPAN&gt;specific service.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = CALCULATE(DISTINCTCOUNT(TableB[Client ID]),
            FILTER(ALL(TableB),
                (TableB[Service]="A"&amp;amp;&amp;amp;TableB[Contacted in 48]="True")||
                (CALCULATE(MAX(TableB[Contacted in 48]),ALLEXCEPT(TableB,TableB[Client ID]))="True"&amp;amp;&amp;amp;"A" in CALCULATETABLE(VALUES(TableB[Service]),ALLEXCEPT(TableB,TableB[Client ID])))
                    ))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You could create a slicer and replace the "A" to SELECTEDVALUE('slicer'[service]), then you can calculate for the specified service.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jay&lt;/P&gt;</description>
    <pubDate>Wed, 22 Dec 2021 08:28:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-12-22T08:28:42Z</dc:date>
    <item>
      <title>Count if relating to a specific service</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-relating-to-a-specific-service/m-p/2242943#M53760</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am building a report to see how many client were contacted wihtin 48 hours of referral when referred into service A, however if they were contacted through any other service in the 48hrs period then that would count as the client being contacted on behalf of service A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 tables like the following&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Client ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Service&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;A&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3214&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3214&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2341&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2145&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Client ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Service&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Contact Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Contacted in 48&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;12/12/2020&lt;/TD&gt;&lt;TD&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3214&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;01/12/2020&lt;/TD&gt;&lt;TD&gt;False&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3214&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;30/11/2021&lt;/TD&gt;&lt;TD&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2145&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;01/12/2020&lt;/TD&gt;&lt;TD&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to have a distinct count of clients that have been contacted in 48hrs, but they have to be associated with Service A. For example, Client 3214 was not contacted within 48hrs within service A but they were contacted through service B, and because they are also in service A this would be counted. However, 2145 would not be counted as they are not in service A. 1234 would be counted becuase they have been contacted in 48hrs and are in service A.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something along the lines of a distinct count of clients in any service who have been contacted in 48hrs only if they are also a part of service A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this makes sense&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Elin&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 17:08:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-relating-to-a-specific-service/m-p/2242943#M53760</guid>
      <dc:creator>elinevans</dc:creator>
      <dc:date>2021-12-16T17:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Count if relating to a specific service</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-relating-to-a-specific-service/m-p/2243014#M53764</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="310221" data-lia-user-login="elinevans" class="lia-mention lia-mention-user"&gt;elinevans&lt;/a&gt;&amp;nbsp; you can use a measure like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _left =
    SUMMARIZE (
        CALCULATETABLE (
            'Table 1',
            'Table 1'[Service] IN { "A" },
            ALLEXCEPT ( 'Table 1', 'Table 1'[Client ID] )
        ),
        'Table 1'[Client ID]
    )
VAR _right =
    SUMMARIZE (
        FILTER ( 'Table 2', 'Table 2'[Contacted in 48] = TRUE () ),
        'Table 2'[Client ID]
    )
RETURN
    COUNTX ( INTERSECT ( _left, _right ), 'Table 1'[Client ID] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&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;</description>
      <pubDate>Thu, 16 Dec 2021 17:49:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-relating-to-a-specific-service/m-p/2243014#M53764</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-12-16T17:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count if relating to a specific service</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-relating-to-a-specific-service/m-p/2243358#M53773</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="310221" data-lia-user-login="elinevans" class="lia-mention lia-mention-user"&gt;elinevans&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my suggestion:&lt;/P&gt;&lt;LI-CODE lang="php"&gt;Measure 2 = 
Var _A = 
filter(ADDCOLUMNS(SUMMARIZE('Table (2)','Table (2)'[Client ID],"Service",MIN('Table (2)'[Service])),"T/F",CALCULATE(COUNTROWS('Table (2)'),'Table (2)'[Contacted in 48]=true())),[Service]="A")
return
COUNTROWS(_A)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&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;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;helps&lt;/SPAN&gt;&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;accepting&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;it as the solution&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 22:31:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-relating-to-a-specific-service/m-p/2243358#M53773</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-12-16T22:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Count if relating to a specific service</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-relating-to-a-specific-service/m-p/2251519#M54219</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="310221" data-lia-user-login="elinevans" class="lia-mention lia-mention-user"&gt;elinevans&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a measure to count the clients for&amp;nbsp;&lt;SPAN&gt;specific service.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = CALCULATE(DISTINCTCOUNT(TableB[Client ID]),
            FILTER(ALL(TableB),
                (TableB[Service]="A"&amp;amp;&amp;amp;TableB[Contacted in 48]="True")||
                (CALCULATE(MAX(TableB[Contacted in 48]),ALLEXCEPT(TableB,TableB[Client ID]))="True"&amp;amp;&amp;amp;"A" in CALCULATETABLE(VALUES(TableB[Service]),ALLEXCEPT(TableB,TableB[Client ID])))
                    ))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You could create a slicer and replace the "A" to SELECTEDVALUE('slicer'[service]), then you can calculate for the specified service.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jay&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 08:28:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-if-relating-to-a-specific-service/m-p/2251519#M54219</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-22T08:28:42Z</dc:date>
    </item>
  </channel>
</rss>

