Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Elichka
Resolver I
Resolver I

Count rows in table visual

Hello, how to get the number of rows as the total value in a table visual since the data is from multiple tables? Appreciate any help!

Thank you

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

It will depend upon the fields that you have dragged to the visual.  Share the download link of the PBI file and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-tangjie-msft
Community Support
Community Support

Hi @Elichka ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please feel free to let me know.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

christinepayton
Super User
Super User

You can count whatever the primary key on the table is. Like if you have a table that shows customer ID, customer name, order quantity and sales amount, coming from 2+ tables, you would count the customer ID row as that would be what is making the rows unique.

 

It's kind of hard to get it to show up in a table visual in a way that is visually appealing, because any row count is just going to return 1 on each row before you get to the total at the bottom... sometimes I'll turn off the alternating row color and set the font to white to match the background on the values for that column to make it look slightly less lame... the total will still show in the normal font color.

123abc
Community Champion
Community Champion

RowCount = COUNTROWS('YourTableName')

 

Replace 'YourTableName' with the name of the table you want to count the rows for. You can find the table name in the Power BI Fields pane.

  1. Press Enter to create the measure.

  2. Once you've created the measure, you can add it to your table visual. Simply drag and drop the "RowCount" measure from the Fields pane onto the Values or Columns area of the table visual.

This measure will display the total count of rows for the table visual you specified. When you add it to your table visual, you'll see the count displayed as a single value in your table.

If your data is coming from multiple tables, you should create separate measures for each table that you want to count, following the same steps. This way, you can have individual row counts for each table in your report. 

 

OR

 

Assuming you have two tables, Table1 and Table2, and you want to count the rows in both of them:

TotalRowCount = COUNTROWS(Table1) + COUNTROWS(Table2)

You can expand this pattern to include additional tables by adding more COUNTROWS functions and summing them up.

  1. Go to the "Modeling" tab in the Power BI ribbon.

  2. In the "Calculations" group, click on "New Measure."

  3. In the formula bar, enter the DAX measure formula as shown above, taking into account all the tables you want to count.

  4. Press Enter to create the measure.

  5. Once you've created the measure, you can add it to your table visual by dragging and dropping the "TotalRowCount" measure onto the Values or Columns area of the table visual.

This measure will display the total count of rows from all the specified tables in your table visual.

Remember to adjust the DAX measure based on the actual table names and the number of tables you want to count rows for in your report.

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.