<?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: Countrows help in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Countrows-help/m-p/3045306#M104648</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you! Not just for the solution but for the explaination, really helped clarify how the functions work.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jan 2023 14:27:46 GMT</pubDate>
    <dc:creator>tberr86</dc:creator>
    <dc:date>2023-01-26T14:27:46Z</dc:date>
    <item>
      <title>Countrows help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Countrows-help/m-p/3043751#M104554</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Working on a measure that calculates a count of homes based on two conditions: homes still being built and finished but unsold, without duplicates. I'm sure there are a few approaches to this, here is what I came up with:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total WIP = &lt;/SPAN&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; ActiveWIP = &lt;/SPAN&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATETABLE&lt;/SPAN&gt;&lt;SPAN&gt;('SCHEDHOUSEDETAIL','SCHEDHOUSEDETAIL'[activitycode]=&lt;/SPAN&gt;&lt;SPAN&gt;"Q75"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;('SCHEDHOUSEDETAIL'[actualfinishdate])))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; UnsoldCompletedHomes = COUNTROWS(&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATETABLE&lt;/SPAN&gt;&lt;SPAN&gt;('SCHEDHOUSEDETAIL','SCHEDHOUSEDETAIL'[activitycode]=&lt;/SPAN&gt;&lt;SPAN&gt;"Q75"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;NOT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;('SCHEDHOUSEDETAIL'[actualfinishdate])),&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(RELATED('HOUSE MASTER'[contract_date])),&lt;/SPAN&gt;&lt;SPAN&gt;NOT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;(RELATED('HOUSE MASTER'[Start Date])))))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;SPAN&gt; ActiveWIP+UnsoldCompletedHomes&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hopefully this gives a clear idea of what the function is trying to accomplish. There is a many to one relationship between schedhousedetail and housemaster. I know I'm wrong in the RELATED function, but not sure how to accomplish this.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I appreciate the guidance!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Jan 2023 21:17:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Countrows-help/m-p/3043751#M104554</guid>
      <dc:creator>tberr86</dc:creator>
      <dc:date>2023-01-25T21:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Countrows help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Countrows-help/m-p/3044155#M104587</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="346962" data-lia-user-login="tberr86" class="lia-mention lia-mention-user"&gt;tberr86&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you've rightly said, RELATED is not required here. RELATED requires a row context which does not exist in a measure (unless introduced within the measure by an iterator). In any case, filters applied to tables on the 1-side of a 1:many relationship automatically "propogate" from the 1-side to the many-side table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would also suggest &lt;STRONG&gt;CALCULATE ( COUNTROWS (...) )&lt;/STRONG&gt; rather than &lt;STRONG&gt;COUNTROWS ( CALCULATETABLE (...) )&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, since the "Q75" filter is common to both components of the measure, you could use an outer CALCULATE with that filter applied, and place the remaining filters within nested CALCULATE calls.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Putting all this together, you could write something like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total WIP =
CALCULATE (
    VAR ActiveWIP =
        CALCULATE (
            COUNTROWS ( 'SCHEDHOUSEDETAIL' ),
            ISBLANK ( 'SCHEDHOUSEDETAIL'[actualfinishdate] )
        )
    VAR UnsoldCompletedHomes =
        CALCULATE (
            COUNTROWS ( 'SCHEDHOUSEDETAIL' ),
            NOT ISBLANK ( 'SCHEDHOUSEDETAIL'[actualfinishdate] ),
            ISBLANK ( 'HOUSE MASTER'[contract_date] ),
            NOT ISBLANK ( 'HOUSE MASTER'[Start Date] )
        )
    RETURN
        ActiveWIP + UnsoldCompletedHomes,
    'SCHEDHOUSEDETAIL'[activitycode] = "Q75"
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you could create two separate measures for ActiveWIP and UnsoldCompleteHomes, and sum them in the Total WIP.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does the above measure give the expected result?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 02:48:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Countrows-help/m-p/3044155#M104587</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2023-01-26T02:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Countrows help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Countrows-help/m-p/3045306#M104648</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you! Not just for the solution but for the explaination, really helped clarify how the functions work.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 14:27:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Countrows-help/m-p/3045306#M104648</guid>
      <dc:creator>tberr86</dc:creator>
      <dc:date>2023-01-26T14:27:46Z</dc:date>
    </item>
  </channel>
</rss>

