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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.