<?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 Counting Rows of the Results given by a Measure from a Column in a Table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-of-the-Results-given-by-a-Measure-from-a-Column-in/m-p/3165595#M113846</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have the following table in my report:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I am trying to work out a DAX logic that will effectively distinct count the number of tenants for each Building Name.&lt;/P&gt;&lt;P&gt;Already in Leased Area column is a measure which successfully applied a number of filters for rows of the table in the data model and sums up the values accordingly to give the total against that corresponding Building Name.&lt;/P&gt;&lt;P&gt;I want to use the same filter logic but perform a count of the results after that filtering is applied.&lt;/P&gt;&lt;P&gt;I have 2 questions:&lt;/P&gt;&lt;P&gt;1. What's the best way to use count to do this?&lt;/P&gt;&lt;P&gt;2. Since the same filtering logic might be used for additional column measures I might add to this table, is it more sensible to apply the filter one time as a measure in the filter pane and write these addiditional column measure calculations assuming this base filter logic has already been applied? For example, I could apply the base filtering in the filter pane for the visual with a conditional IF statement to say if all conditions are met for a row in the table then flag as 1, then filter just the 1s etc.&lt;/P&gt;&lt;P&gt;My measue for the Leased Area column of the table above is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Leased Area = 
VAR _asOfDate = [As Of Date]
VAR _assetref = MAX(Building[Asset Reference])

RETURN
VAR result = CALCULATE (
        SUMX (
            VALUES (Lease_Unit[Unit Reference] ),
            SUMX (
                TOPN (
                    1,
                    FILTER (
                        Lease_Unit,
                        Lease_Unit[Unit Reference] = EARLIER ( Lease_Unit[Unit Reference] )
                    ),
                    Lease_Unit[Lease.Commencement Date]
                ),
                Lease_Unit[Leased Area]
            )
        ),
            
               OR(
                    ISBLANK ( Lease_Unit[Unit.Unit Start Date] ),
                    Lease_Unit[Unit.Unit Start Date] &amp;lt;= _asofdate
                )
                &amp;amp;&amp;amp; OR (
                    ISBLANK ( Lease_Unit[Unit.Unit End Date] ),
                    Lease_Unit[Unit.Unit End Date] &amp;gt;= _asofdate
                    )
           , 
        AND (
            Lease_Unit[Lease.Expiration Date] &amp;gt;= _asOfDate,
            Lease_Unit[Lease.Commencement Date] &amp;lt;= _asOfDate
        )
            || Lease_Unit[Lease.Lease Status] IN { "Holding Over", "Month-to-Month" },
        OR( 
            Lease_Unit[Lease.Termination Date] &amp;gt;= _asOfDate, 
        isblank(Lease_Unit[Lease.Termination Date])
        )
    )
RETURN
IF( result = BLANK() &amp;amp;&amp;amp; ISBLANK([Total Leasable Area (Current)]) = FALSE, 0, result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The measue I'd been using for the Tenants column, which is currently incorrect, is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Tenants = 
VAR _table =
    FILTER (
        SUMMARIZECOLUMNS (
            Lease_Unit[Asset Reference],
            Lease_Unit[Lease_DST.Tenant Reference]
        ),
        SUM(Lease_Unit[Leased Area]) &amp;gt; 0
    )
RETURN
    COUNTROWS ( _table )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How best should I go about using the filtering inherent in [Total Leased Area] to make a count of the results for each buillding name per row of the table?&lt;BR /&gt;How can I then create a card visual with the grand total of all tenants?&lt;/P&gt;</description>
    <pubDate>Fri, 31 Mar 2023 11:26:43 GMT</pubDate>
    <dc:creator>julesdude</dc:creator>
    <dc:date>2023-03-31T11:26:43Z</dc:date>
    <item>
      <title>Counting Rows of the Results given by a Measure from a Column in a Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-of-the-Results-given-by-a-Measure-from-a-Column-in/m-p/3165595#M113846</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have the following table in my report:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I am trying to work out a DAX logic that will effectively distinct count the number of tenants for each Building Name.&lt;/P&gt;&lt;P&gt;Already in Leased Area column is a measure which successfully applied a number of filters for rows of the table in the data model and sums up the values accordingly to give the total against that corresponding Building Name.&lt;/P&gt;&lt;P&gt;I want to use the same filter logic but perform a count of the results after that filtering is applied.&lt;/P&gt;&lt;P&gt;I have 2 questions:&lt;/P&gt;&lt;P&gt;1. What's the best way to use count to do this?&lt;/P&gt;&lt;P&gt;2. Since the same filtering logic might be used for additional column measures I might add to this table, is it more sensible to apply the filter one time as a measure in the filter pane and write these addiditional column measure calculations assuming this base filter logic has already been applied? For example, I could apply the base filtering in the filter pane for the visual with a conditional IF statement to say if all conditions are met for a row in the table then flag as 1, then filter just the 1s etc.&lt;/P&gt;&lt;P&gt;My measue for the Leased Area column of the table above is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Leased Area = 
VAR _asOfDate = [As Of Date]
VAR _assetref = MAX(Building[Asset Reference])

RETURN
VAR result = CALCULATE (
        SUMX (
            VALUES (Lease_Unit[Unit Reference] ),
            SUMX (
                TOPN (
                    1,
                    FILTER (
                        Lease_Unit,
                        Lease_Unit[Unit Reference] = EARLIER ( Lease_Unit[Unit Reference] )
                    ),
                    Lease_Unit[Lease.Commencement Date]
                ),
                Lease_Unit[Leased Area]
            )
        ),
            
               OR(
                    ISBLANK ( Lease_Unit[Unit.Unit Start Date] ),
                    Lease_Unit[Unit.Unit Start Date] &amp;lt;= _asofdate
                )
                &amp;amp;&amp;amp; OR (
                    ISBLANK ( Lease_Unit[Unit.Unit End Date] ),
                    Lease_Unit[Unit.Unit End Date] &amp;gt;= _asofdate
                    )
           , 
        AND (
            Lease_Unit[Lease.Expiration Date] &amp;gt;= _asOfDate,
            Lease_Unit[Lease.Commencement Date] &amp;lt;= _asOfDate
        )
            || Lease_Unit[Lease.Lease Status] IN { "Holding Over", "Month-to-Month" },
        OR( 
            Lease_Unit[Lease.Termination Date] &amp;gt;= _asOfDate, 
        isblank(Lease_Unit[Lease.Termination Date])
        )
    )
RETURN
IF( result = BLANK() &amp;amp;&amp;amp; ISBLANK([Total Leasable Area (Current)]) = FALSE, 0, result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The measue I'd been using for the Tenants column, which is currently incorrect, is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Tenants = 
VAR _table =
    FILTER (
        SUMMARIZECOLUMNS (
            Lease_Unit[Asset Reference],
            Lease_Unit[Lease_DST.Tenant Reference]
        ),
        SUM(Lease_Unit[Leased Area]) &amp;gt; 0
    )
RETURN
    COUNTROWS ( _table )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How best should I go about using the filtering inherent in [Total Leased Area] to make a count of the results for each buillding name per row of the table?&lt;BR /&gt;How can I then create a card visual with the grand total of all tenants?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 11:26:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-of-the-Results-given-by-a-Measure-from-a-Column-in/m-p/3165595#M113846</guid>
      <dc:creator>julesdude</dc:creator>
      <dc:date>2023-03-31T11:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Rows of the Results given by a Measure from a Column in a Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-of-the-Results-given-by-a-Measure-from-a-Column-in/m-p/3170592#M114274</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="399757" data-lia-user-login="julesdude" class="lia-mention lia-mention-user"&gt;julesdude&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&amp;nbsp;&lt;/A&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 01:56:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-Rows-of-the-Results-given-by-a-Measure-from-a-Column-in/m-p/3170592#M114274</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-04T01:56:26Z</dc:date>
    </item>
  </channel>
</rss>

