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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Hodor
Regular Visitor

Is there an equivalent to COUNTIFS based on dynamic value from a slicer input in DAX?

Hello,

I have a table called "List" with two column...Name, and Team such as this:

 

 

I would like to create a measure to count the number of Names (rows) that belong to the same Team as the name slected in a slicer.

For example, I have a slicer for the Name column... If I select Charlie from that slicer, I could like a measure to output 3 because Charlie is in team B and there are 3 Names in team B.

 

 

I have the following DAX: CALCULATE (COUNTROWS('List'),FILTER('List','List'[Team]=SELECTEDVALUE('List'[Team])))

But it isn't calculating correctly.

 

Please Help!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

[Team Count] =
var __oneNameSelected = hasonefilter ( T[Name] )
var __teamCount =
	calculate(
		countrows ( T ),
		all ( T ),
		values ( T[Team] )
	)
return
	if(
		__oneNameSelected,
		__teamCount
	)

Best

Darek

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

[Team Count] =
var __oneNameSelected = hasonefilter ( T[Name] )
var __teamCount =
	calculate(
		countrows ( T ),
		all ( T ),
		values ( T[Team] )
	)
return
	if(
		__oneNameSelected,
		__teamCount
	)

Best

Darek

Thank you!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors