Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Count Rows per Group with Filter Responsiveness

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:

IDClassificationDaysCount
ID1Historical72
ID1Historical142
ID1Historical211
ID2Historical72
ID2Historical142
ID3Current73
ID3Current141
ID3Current211
ID4Current73
ID5Current73

 

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:

IDClassificationDaysCount (with current formula - same as above)VALUE I NEED
ID1Historical721
ID1Historical1421
ID1Historical2111
ID4Current731

 

Does anyone have suggestions for how to get the column values I need?

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @Anonymous 

try a measure

Count = CALCULATE(COUNTROWS(TableName),
FILTER(ALLSELECTED(TableName),
TableName[Classification]=SELECTEDVALUE(TableName[Classification]) && TableName[Days]=SELECTEDVALUE(TableName[Days])))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

2 REPLIES 2
az38
Community Champion
Community Champion

Hi @Anonymous 

try a measure

Count = CALCULATE(COUNTROWS(TableName),
FILTER(ALLSELECTED(TableName),
TableName[Classification]=SELECTEDVALUE(TableName[Classification]) && TableName[Days]=SELECTEDVALUE(TableName[Days])))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
VasTg
Memorable Member
Memorable Member

@Anonymous 

 

Replace COUNT with DISTINCTCOUNT

 

If it helps, mark it as a solution
Kudos are nice too

Connect on LinkedIn

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.