<?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 Distinct Count by comparing two summarized tables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-by-comparing-two-summarized-tables/m-p/3373847#M127008</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to DAX and need your support in solving this problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two Excel files. One contains yearly target planned for different activities while the second contains monthly reports of reached. I want to count those activities that are lagging behind.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&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;2.&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;I tried to do smoething like this but I got lost in the middle:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;var maxMonth = MAX('Reached'[month])&lt;BR /&gt;var target_table =SUMMARIZE('Target', 'Target'[Activity], "Monthly Target", CALCULATE ( DIVIDE(SUM( 'Target'[Target] ),12,0)))&lt;BR /&gt;var beneficiary_table = SUMMARIZE('Reached', 'Reached'[Activity], "Monthly Reached", CALCULATE ( DIVIDE(SUM( 'Reached'[Reached] ),maxMonth,0)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is a measure that distinct counts activities that are lagging behind ie. Monthly Target &amp;gt; Monthly Reached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would very much appreacite your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Aug 2023 09:22:32 GMT</pubDate>
    <dc:creator>enoch99</dc:creator>
    <dc:date>2023-08-10T09:22:32Z</dc:date>
    <item>
      <title>Distinct Count by comparing two summarized tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-by-comparing-two-summarized-tables/m-p/3373847#M127008</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to DAX and need your support in solving this problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two Excel files. One contains yearly target planned for different activities while the second contains monthly reports of reached. I want to count those activities that are lagging behind.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&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;2.&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;I tried to do smoething like this but I got lost in the middle:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;var maxMonth = MAX('Reached'[month])&lt;BR /&gt;var target_table =SUMMARIZE('Target', 'Target'[Activity], "Monthly Target", CALCULATE ( DIVIDE(SUM( 'Target'[Target] ),12,0)))&lt;BR /&gt;var beneficiary_table = SUMMARIZE('Reached', 'Reached'[Activity], "Monthly Reached", CALCULATE ( DIVIDE(SUM( 'Reached'[Reached] ),maxMonth,0)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is a measure that distinct counts activities that are lagging behind ie. Monthly Target &amp;gt; Monthly Reached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would very much appreacite your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 09:22:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-by-comparing-two-summarized-tables/m-p/3373847#M127008</guid>
      <dc:creator>enoch99</dc:creator>
      <dc:date>2023-08-10T09:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count by comparing two summarized tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-by-comparing-two-summarized-tables/m-p/3374071#M127034</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="558568" data-lia-user-login="enoch99" class="lia-mention lia-mention-user"&gt;enoch99&lt;/a&gt;&amp;nbsp;based on above dataset, what is the expected result. Can you mention that as well?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 11:43:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-by-comparing-two-summarized-tables/m-p/3374071#M127034</guid>
      <dc:creator>nandukrishnavs</dc:creator>
      <dc:date>2023-08-10T11:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count by comparing two summarized tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-by-comparing-two-summarized-tables/m-p/3374084#M127036</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="32333" data-lia-user-login="nandukrishnavs" class="lia-mention lia-mention-user"&gt;nandukrishnavs&lt;/a&gt;I want a table like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I can compare the Target and Reached columns after that to count the number of activities lagging behind.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 11:53:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-by-comparing-two-summarized-tables/m-p/3374084#M127036</guid>
      <dc:creator>enoch99</dc:creator>
      <dc:date>2023-08-10T11:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count by comparing two summarized tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-by-comparing-two-summarized-tables/m-p/3374171#M127043</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="558568" data-lia-user-login="enoch99" class="lia-mention lia-mention-user"&gt;enoch99&lt;/a&gt;&amp;nbsp;You can create a calculated column in Target table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Reached =
SUMX (
    FILTER ( Reached, [Activity] = EARLIEST ( Target[Activity] ) ),
    [Reached]
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;If you need a measure, then try the below measure&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Lagging = 
VAR _target =
    ADDCOLUMNS (
        Target,
        "@Reached",
            SUMX (
                FILTER ( Reached, [Activity] = EARLIER ( Target[Activity] ) ),
                [Reached]
            )
    )
VAR _result =
    COUNTX ( FILTER ( _target, [@Reached] &amp;lt; [Target] ), [Activity] )
RETURN
    _result&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 10 Aug 2023 12:39:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-by-comparing-two-summarized-tables/m-p/3374171#M127043</guid>
      <dc:creator>nandukrishnavs</dc:creator>
      <dc:date>2023-08-10T12:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count by comparing two summarized tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-by-comparing-two-summarized-tables/m-p/3374616#M127076</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="32333" data-lia-user-login="nandukrishnavs" class="lia-mention lia-mention-user"&gt;nandukrishnavs&lt;/a&gt;&amp;nbsp; Thank you for your quick response. This is what I was looking for.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 15:47:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-by-comparing-two-summarized-tables/m-p/3374616#M127076</guid>
      <dc:creator>enoch99</dc:creator>
      <dc:date>2023-08-10T15:47:04Z</dc:date>
    </item>
  </channel>
</rss>

