Forum Discussion
Need Help with Dynamic Row count Based on Table Visual and Slicers
- 8 months ago
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
- 8 months ago
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.
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:
| 1 | 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.