<?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 Rows in Visual in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4257396#M168682</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your question correctly, but I think we can try using numeric parameter something like below. Please check the below picture and the attached pbix file.&lt;BR /&gt;Or, please share your sample pbix file's link to help me to have a bit more clear understanding.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-what-if?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;Use parameters to visualize variables - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&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;</description>
    <pubDate>Fri, 25 Oct 2024 05:23:04 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2024-10-25T05:23:04Z</dc:date>
    <item>
      <title>Count Rows in Visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4255407#M168572</link>
      <description>&lt;P&gt;I want to count rows in a Matrix visual.&amp;nbsp; The row count would change based on what is selected in the slicers.&amp;nbsp; &amp;nbsp;I want to put the count in a card that will change dynamically based on what is selected in the slicers.&amp;nbsp; The categories I have are Location and # of Sales.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried Count(Location), but I keep getting the error "parameter is not the correct type".&amp;nbsp; I tried CountRows, which asks for the table.&amp;nbsp; What table?&amp;nbsp; &amp;nbsp;Location comes from one table and # Sales comes from another table!&amp;nbsp; I'm new to this, but in Excel it's SO EASY. &amp;nbsp;How can I make this work please?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 03:40:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4255407#M168572</guid>
      <dc:creator>BrianNeedsHelp</dc:creator>
      <dc:date>2024-10-24T03:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Count Rows in Visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4255534#M168575</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="828752" data-lia-user-login="BrianNeedsHelp" class="lia-mention lia-mention-user"&gt;BrianNeedsHelp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would need to do something like this:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a measure that constructs a table containing the same columns/measures as the matrix visual, and counts the rows.&lt;/LI&gt;
&lt;LI&gt;Place that measure on a card visual and ensure the same slicers are filtering both the matrix and card.&amp;nbsp;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;STRONG&gt;Explanation:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Matrix visuals generate queries using SUMMARIZECOLUMNS behind the scenes, which you can capture and examine using Performance Analyzer (see &lt;A href="https://learn.microsoft.com/en-us/power-bi/transform-model/dax-query-view#getting-visual-dax-queries-from-performance-analyzer" target="_blank" rel="noopener"&gt;here&lt;/A&gt;).&lt;/LI&gt;
&lt;LI&gt;With default settings, the number of rows in a matrix (and returned by SUMMARIZECOLUMNS) depends on the combinations of row fields for which at least one measure is nonblank in at least one column.&lt;/LI&gt;
&lt;LI&gt;To create your row count measure, you can take the SUMMARIZECOLUMNS component of the query and simplify/modify to produce the number of rows you actually need, depending whether you want to include subtotals etc. Then count the rows of the resulting table.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Simple example (PBIX attached):&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Assume we have a matrix containing &lt;STRONG&gt;Country &lt;/STRONG&gt;and&amp;nbsp;&lt;STRONG&gt;Brand&lt;/STRONG&gt;&amp;nbsp;on rows, and &lt;STRONG&gt;Sales Amount &lt;/STRONG&gt;as the only measure&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;The matrix does not include subtotals or grand total.&lt;/LI&gt;
&lt;LI&gt;We can then create this measure to count the rows and display on a card visual:&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI-CODE lang="markup"&gt;Matrix Row Count - Country|Brand|Sales Amount = 
COUNTROWS (
    SUMMARIZECOLUMNS (
        'Product'[Brand],
        Customer[Country],
        "Sales Amount", [Sales Amount]
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Notes:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The measure assumes specific row/column/measure fields are used in the visual.&lt;/LI&gt;
&lt;LI&gt;This would need to be modified if subtotal rows are to be included or if fields are placed in columns rather than rows.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 05:42:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4255534#M168575</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2024-10-24T05:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Count Rows in Visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4255551#M168576</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;In the measure, I used COUNTROWS DAX function.&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;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/countrows-function-dax?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;COUNTROWS function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Location count: =
VAR _t =
    SUMMARIZE (
        sales,
        location[location]
    )
RETURN
    COUNTROWS ( _t )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 05:48:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4255551#M168576</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-10-24T05:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Count Rows in Visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4256650#M168649</link>
      <description>&lt;P&gt;It works for the Slicers when I just use Location.&amp;nbsp; When I try to add Sales it says "Parameter is not the correct type".&amp;nbsp; &amp;nbsp;But it works like I had wanted, but I forgot to mention that I used a filter for Sales Amount.&amp;nbsp; So the whole idea is to count location where the Sales Amount is less than X amount.&amp;nbsp; So it ignores that when it's counting the rows-it correctly counts only what's selected in the slicer.&amp;nbsp; So any idea on that part?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 16:38:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4256650#M168649</guid>
      <dc:creator>BrianNeedsHelp</dc:creator>
      <dc:date>2024-10-24T16:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Count Rows in Visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4257396#M168682</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your question correctly, but I think we can try using numeric parameter something like below. Please check the below picture and the attached pbix file.&lt;BR /&gt;Or, please share your sample pbix file's link to help me to have a bit more clear understanding.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-what-if?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;Use parameters to visualize variables - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&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;</description>
      <pubDate>Fri, 25 Oct 2024 05:23:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4257396#M168682</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-10-25T05:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count Rows in Visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4257423#M168683</link>
      <description>&lt;P&gt;Thank you. &amp;nbsp;I'll look at the Pbix as soon as I can. &amp;nbsp;I was meaning that let's say there are a 100 rows in table. &amp;nbsp;If I use the slicer to select a filter, it correctly counts the rows e.g. 75 rows. &amp;nbsp;But on the filter pane I have selected to show sales less than x amount. &amp;nbsp;So in the visual it counts 75 rows but should only count 50 rows. &amp;nbsp;I think that's how you have it displayed but just wanted to explain. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 05:40:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4257423#M168683</guid>
      <dc:creator>BrianNeedsHelp</dc:creator>
      <dc:date>2024-10-25T05:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Count Rows in Visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4258752#M168746</link>
      <description>&lt;P&gt;This works amazing!&amp;nbsp; Thank you so much for the PBIX.&amp;nbsp; &amp;nbsp;I was able to implement it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2024 03:33:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Rows-in-Visual/m-p/4258752#M168746</guid>
      <dc:creator>BrianNeedsHelp</dc:creator>
      <dc:date>2024-10-26T03:33:36Z</dc:date>
    </item>
  </channel>
</rss>

