Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I want to count rows in a Matrix visual. The row count would change based on what is selected in the slicers. I want to put the count in a card that will change dynamically based on what is selected in the slicers. The categories I have are Location and # of Sales.
I tried Count(Location), but I keep getting the error "parameter is not the correct type". I tried CountRows, which asks for the table. What table? Location comes from one table and # Sales comes from another table! I'm new to this, but in Excel it's SO EASY. How can I make this work please?
Solved! Go to Solution.
Hi,
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.
Or, please share your sample pbix file's link to help me to have a bit more clear understanding.
Use parameters to visualize variables - Power BI | Microsoft Learn
It works for the Slicers when I just use Location. When I try to add Sales it says "Parameter is not the correct type". But it works like I had wanted, but I forgot to mention that I used a filter for Sales Amount. So the whole idea is to count location where the Sales Amount is less than X amount. So it ignores that when it's counting the rows-it correctly counts only what's selected in the slicer. So any idea on that part?
Hi,
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.
Or, please share your sample pbix file's link to help me to have a bit more clear understanding.
Use parameters to visualize variables - Power BI | Microsoft Learn
This works amazing! Thank you so much for the PBIX. I was able to implement it.
Thank you. I'll look at the Pbix as soon as I can. I was meaning that let's say there are a 100 rows in table. If I use the slicer to select a filter, it correctly counts the rows e.g. 75 rows. But on the filter pane I have selected to show sales less than x amount. So in the visual it counts 75 rows but should only count 50 rows. I think that's how you have it displayed but just wanted to explain.
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
In the measure, I used COUNTROWS DAX function.
COUNTROWS function (DAX) - DAX | Microsoft Learn
Location count: =
VAR _t =
SUMMARIZE (
sales,
location[location]
)
RETURN
COUNTROWS ( _t )
You would need to do something like this:
Explanation:
Simple example (PBIX attached):
Matrix Row Count - Country|Brand|Sales Amount =
COUNTROWS (
SUMMARIZECOLUMNS (
'Product'[Brand],
Customer[Country],
"Sales Amount", [Sales Amount]
)
)
Notes:
Regards
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
18 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |