cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hodor Frequent Visitor
Frequent 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

Accepted Solutions
Super User
Super User

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

[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
Super User
Super User

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

[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

Highlighted
Hodor Frequent Visitor
Frequent Visitor

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

Thank you!!

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 6 members 1,531 guests
Please welcome our newest community members: