<?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 number of rows in another table with same ID in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3570397#M137657</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Work almost as it should. Everything is fine when choosing a single product. Only issue, is that if I choose two products. For example A &amp;amp; B I get 11 as a result, where I expect 8.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Dec 2023 12:18:21 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-12-06T12:18:21Z</dc:date>
    <item>
      <title>Count number of rows in another table with same ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3568486#M137580</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a quite simple (I think) DAX question, that I hope you can help me with. Tried to find similar in the forum, without luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hav two tables:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Table 1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;&amp;nbsp;&lt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12&lt;/TD&gt;&lt;TD&gt;678&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a relation between the to tables, on Customer - Many-to-one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now:&lt;/P&gt;&lt;P&gt;If I have a filter on table 1 with Product = "A",&lt;/P&gt;&lt;P&gt;I wan't to create a meassure to count how many related customers in Table2 are on a reservation where another customer bought this product.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, in above example, if I filter on product "A", I can see that 6 customers are on a reservations that bought this product and thereby my desired result is "6".&lt;/P&gt;&lt;P&gt;If there is no filtering done on product level, I expect the result to be 11, as there is 11 customers on the reservations which have got any kind of product. (ie. reservation 234 bought two products, customer 10-12 is on reservations that are not present in table1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been walking around, some Countrows, including a calculate with allselected, but I haven't been able to find the solution yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking forward to see your suggestions. Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 13:27:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3568486#M137580</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-05T13:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of rows in another table with same ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3570135#M137649</link>
      <description>&lt;H3&gt;Hi, Ramp85&lt;/H3&gt;
&lt;P&gt;May I ask if this is the expected output you are looking for? Based on your description, I have created a measure to achieve the effect you are looking for. Following picture shows the effect of the display.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;RelatedCustomerCount =

IF (

    ISBLANK ( SELECTEDVALUE ( Table1[Product] ) ),

    COUNTROWS ( Table2 )

        - ( COUNT ( Table1[ReservationID] ) - DISTINCTCOUNT ( Table1[ReservationID] ) ),

    CALCULATE (

        COUNTROWS ( 'Table2' ),

        FILTER (

            'Table2',

            'Table2'[ReservationID] IN VALUES ( 'Table1'[ReservationID] )

        ),

        ALLSELECTED ( 'Table1' )

    )

)&lt;/LI-CODE&gt;
&lt;P&gt;If this does not work, could you please share some sample data without sensitive information and expected output.&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;How to provide sample data in the Power BI Forum - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C01%7Cv-yaningyang%40microsoft.com%7Cce16d19809414d9f960208dbf1755128%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638369258411601530%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=oBisEpJnsk4p%2BcSV0F8sZ%2BFQHR%2FRvYA8sUWZIEcjQ4o%3D&amp;amp;reserved=0" target="_blank"&gt;How to get your questions answered quickly&lt;/A&gt;&amp;nbsp;--&amp;nbsp;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-provide-sample-data-in-the-Power-BI-Forum%2Fba-p%2F963216&amp;amp;data=05%7C01%7Cv-yaningyang%40microsoft.com%7Cce16d19809414d9f960208dbf1755128%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638369258411609718%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=sCaEt5xd5uTLXCby0%2B1XhR9V7RXxZLDCF088%2F9u%2FOUU%3D&amp;amp;reserved=0" target="_blank"&gt;&amp;nbsp;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 09:39:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3570135#M137649</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-06T09:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of rows in another table with same ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3570397#M137657</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Work almost as it should. Everything is fine when choosing a single product. Only issue, is that if I choose two products. For example A &amp;amp; B I get 11 as a result, where I expect 8.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 12:18:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3570397#M137657</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-06T12:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of rows in another table with same ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3570907#M137681</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# related customers = CALCULATE(DISTINCTCOUNT('Table 2'[Customer]), TREATAS(VALUES('Table 1'[ReservationID]), 'Table 2'[ReservationID]))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 06 Dec 2023 16:24:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3570907#M137681</guid>
      <dc:creator>sjoerdvn</dc:creator>
      <dc:date>2023-12-06T16:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of rows in another table with same ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3574579#M137818</link>
      <description>&lt;P&gt;Dosn't change result when I filter on Products?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 14:30:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3574579#M137818</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-08T14:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of rows in another table with same ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3574709#M137823</link>
      <description>&lt;P&gt;I created the tables exactly as described and it works perfectly with a slicer or filter on product. So there is probably more to your model than you have described above.&lt;BR /&gt;Or did you create a computed column instead of a measure?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 15:38:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3574709#M137823</guid>
      <dc:creator>sjoerdvn</dc:creator>
      <dc:date>2023-12-08T15:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of rows in another table with same ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3577603#M137959</link>
      <description>&lt;P&gt;Hi Again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sry, I must have set something wrong in the first try, now it works like a charm.&lt;BR /&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rgds. Claus&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 13:28:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-number-of-rows-in-another-table-with-same-ID/m-p/3577603#M137959</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-11T13:28:37Z</dc:date>
    </item>
  </channel>
</rss>

