Forum Discussion
CountisBroken
5 months agoNew Member
Count function is doubling
Hi I have a card visual. The count function is doubling everything. Both via a measure and via the "aggregation" option where you choose sum, average, count etc. I've checked the table. ...
- 5 months ago
Hi
Apologies, my dataset had duplicate values under a different file source name - I was filtering on file source assuming they were the only ones containing the data I was analysing - there were other files that had the exact same data. Just another by-product of having to work around your IT team, rather than with them.
Ray_Minds
Solution Supplier
5 months agoExplanation:
The issue comes from how COUNT works in DAX and visuals:
- COUNT(Table[Column]) counts non-blank values in that column, not rows.
- If the column being counted has multiple values per row in the current filter context (or is expanded by auto-exist combinations in the visual), the count can double.
- The built-in “Count” aggregation in visuals behaves the same way.
Solution:
Use COUNTROWS instead of COUNT:
This counts the actual rows in the filtered table, so your card should display 481.
If you need unique values of a column, use: DISTINCTCOUNT
UniqueValue = DISTINCTCOUNT ( Table[Column] )
How to Validate- Add both RowCount and your original measure to a table visual with the same filters.
- Confirm RowCount = 481 while COUNT = 962.
- Replace the card’s aggregation with RowCount