Forum Discussion
Need Help with Dynamic Row count Based on Table Visual and Slicers
Hi Team,
I’m currently working on a project and there is a requirement to display the row count of a table visual.
The row count should update dynamically every time the user interacts with slicers.
Since the fields in the table visual are not static and change based on the user's slicer selection, the row count should also update accordingly and display the correct number of rows shown in the table visual.
Please help me with a solution that allows the row count to change dynamically based on slicer selections.
Thank you
Create a Measure
Nr Rows = COUNTROWS ( YourTable )
This will be dynamic and will feel slicers selections
If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
Hi Pradeep_12 ,
if your visual table is different from yout table you can write a measure as follows:
cnt = var tbl = summarize(your_table , [column1 in visual table] , [column 2 in visual table] ,...)
return
countrows(tbl)
if visual table is the same as your table you just need to write a measure like this:
cnt= countrows(your_table)
If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution ✔️ to help the other members find it more quickly.
9 Replies
- FBergamaschiSuper User
Create a Measure
Nr Rows = COUNTROWS ( YourTable )
This will be dynamic and will feel slicers selections
If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
- Selva-SalimiSolution Sage
Hi Pradeep_12 ,
if your visual table is different from yout table you can write a measure as follows:
cnt = var tbl = summarize(your_table , [column1 in visual table] , [column 2 in visual table] ,...)
return
countrows(tbl)
if visual table is the same as your table you just need to write a measure like this:
cnt= countrows(your_table)
If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution ✔️ to help the other members find it more quickly.
- Kedar_PandeSuper User
You don’t need anything fancy for this.
Row Count =
COUNTROWS ( FactTable )If the table can show rows from different tables or via a field parameter, use ALLSELECTED on the main table behind the visual:
Row Count =
COUNTROWS (
ALLSELECTED ( FactTable )
)Put that in a Card, align it above the table, and you’re done.
If this answer helped, please click Kudos or Accept as Solution.
-Kedar
LinkedIn: https://www.linkedin.com/in/kedar-pande - v-dineshyaCommunity Support
Hi Pradeep_12 ,
Thank you for reaching out to the Microsoft Community Forum.
Please try below measures.
1. Below measure Counts the number of rows currently visible in the table visual. This works with all slicers, page filters, and visual-level filters.
Visible Row Count =
COUNTROWS (
VALUES ( 'Table_name'[RowKeyColumn] )
)Note: RowKeyColumn must uniquely identify a row in the table. (ID, TransactionID, OrderNo, etc). VALUES() respects all slicers & filters. Works even if columns shown in the table visual change.
Please follow below steps.
1. Create this as a measure.
2. Drag it in a Card visual
3. The number updates instantly with slicers
2. It shows the exact row count of the table visual after all visual filters, When Top N, measure filters, or complex visual filters are used.
Visible Row Count (Visual Accurate) =
COUNTROWS (
SUMMARIZE (
'Table_name',
'Table_name'[RowKeyColumn]
)
)
Note: Use Top N, use measure-based filters.
3. If your table uses multiple columns as a “row” (Customer + Date defines one row) , try below measure.Visible Row Count =
COUNTROWS (
SUMMARIZE (
'Table_name',
'Table_name'[Customer],
'Table_name'[Date]
)
)
4. If your table visual is built from MEASURES only (no physical row column), then try below measure.Visible Row Count =
COUNTROWS (
VALUES ( 'DimTable'[DisplayColumn] )
)I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh
- v-dineshyaCommunity Support
Hi Pradeep_12 ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.
Regards,
Dinesh
- v-dineshyaCommunity Support
Hi @Pradeep_12 ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.
Regards,
Dinesh
- Olufemi7Super User
Hi Pradeep_12
You can display a dynamic row count in Power BI Service that updates automatically whenever slicers are applied. The logic is the same as in Desktop, but once you publish the report to the Service, the measure continues to respect all slicers, page filters, and visual filters.
Example Dataset (Dummy Data)
Let’s assume you have a Sales table like this:
TransactionID Customer Region Date SalesAmount1 Alice East 01-Jan-24 120 2 Bob West 02-Jan-24 200 3 Carol East 03-Jan-24 150 4 David North 04-Jan-24 180 5 Emma South 05-Jan-24 220 6 Frank East 06-Jan-24 130 7 Grace West 07-Jan-24 170 DAX Measures
1. Basic Row Count (works with slicers & filters):
Visible Row Count = COUNTROWS ( VALUES ( Sales[TransactionID] ) )
2. Multiple Columns Define a Row (e.g., Customer + Date):Visible Row Count = COUNTROWS ( SUMMARIZE ( Sales, Sales[Customer], Sales[Date] ) )3. Simple Alternative (if table directly uses Sales rows):
Row Count = COUNTROWS ( Sales )Demonstration Steps in Power BI Desktop
Load the dataset above into Power BI (you can paste it into Excel and import, or enter manually).
Create a Table visual showing Customer, Region, and SalesAmount.
Add slicers for Region and Date.
Create the Visible Row Count measure.
Add a Card visual with the measure.
Interact with slicers:
Select Region = East → Table shows 3 rows, Card shows 3.
Select Region = West → Table shows 2 rows, Card shows 2.
Clear slicers → Table shows all 7 rows, Card shows 7.
- Praful_PotphodeSuper User
Hi Pradeep_12 ,
This is the default behaviour of Power BI.
As suggested by FBergamaschi , create a measure for row count and you're all good.
If you have rowcount and slicer columns from 2 different tables, make sure they are connected via relationships and can filter
When ever you select anything in the slicer,it will filter the visualization created on the page.
if you want to turn it off you can use edit interactions.
Please give kudos or mark it solution once confirmed.
Thanks and Regards,
Praful
- Shubham_rai955Super User
Use a simple COUNTROWS over the key column (or a grouped set of columns) and show it in a Card; it will automatically respect all slicers and filters applied to the table visual.
Basic pattern (single table)
If the table visual is driven by one fact/dim table and each row is uniquely identified by a key (e.g. ID, TransactionID):
Visible Row Count := COUNTROWS ( VALUES ( 'YourTable'[RowKeyColumn] ) )VALUES returns the distinct keys visible after slicers, page filters, and visual filters.
COUNTROWS over that list gives the exact row count of the current table visual.
When multiple columns define a row
If a “row” in the table is defined by a combination, e.g. Customer + Date:
Visible Row Count := COUNTROWS ( SUMMARIZE ( 'YourTable', 'YourTable'[Customer], 'YourTable'[Date] ) )SUMMARIZE builds the same grouped grain as your visual, and COUNTROWS counts those groups after all slicers.
Use either measure in a Card visual; it will update dynamically whenever users change slicers or other filters.