Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Anonymous
Not applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Count Rows per Group with Filter Responsiveness
02-18-2020
09:06 AM
Hi folks, I'm trying to create a measure that will respond to filters to give me the number of rows in each group (defined by the value of two columns). Example:
ID | Classification | Days | Count |
ID1 | Historical | 7 | 2 |
ID1 | Historical | 14 | 2 |
ID1 | Historical | 21 | 1 |
ID2 | Historical | 7 | 2 |
ID2 | Historical | 14 | 2 |
ID3 | Current | 7 | 3 |
ID3 | Current | 14 | 1 |
ID3 | Current | 21 | 1 |
ID4 | Current | 7 | 3 |
ID5 | Current | 7 | 3 |
I'm currently using the expression Count = CALCULATE(COUNT([ID]), ALLEXCEPT(TableName, [Classification], [Days])) but this isn't responsive to filters. So, for instance, if I filter by another column and wind up with the following data, the Count column doesn't change:
ID | Classification | Days | Count (with current formula - same as above) | VALUE I NEED |
ID1 | Historical | 7 | 2 | 1 |
ID1 | Historical | 14 | 2 | 1 |
ID1 | Historical | 21 | 1 | 1 |
ID4 | Current | 7 | 3 | 1 |
Does anyone have suggestions for how to get the column values I need?
Solved! Go to Solution.
1 ACCEPTED SOLUTION
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2020
09:16 AM
Hi @Anonymous
try a measure
Count = CALCULATE(COUNTROWS(TableName),
FILTER(ALLSELECTED(TableName),
TableName[Classification]=SELECTEDVALUE(TableName[Classification]) && TableName[Days]=SELECTEDVALUE(TableName[Days])))
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2020
09:16 AM
Hi @Anonymous
try a measure
Count = CALCULATE(COUNTROWS(TableName),
FILTER(ALLSELECTED(TableName),
TableName[Classification]=SELECTEDVALUE(TableName[Classification]) && TableName[Days]=SELECTEDVALUE(TableName[Days])))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2020
09:12 AM
@Anonymous
Replace COUNT with DISTINCTCOUNT
If it helps, mark it as a solution
Kudos are nice too
Connect on LinkedIn

Helpful resources
Top Solution Authors (Last Month)
User | Count |
---|---|
14 | |
12 | |
11 | |
10 | |
9 |