cancel
Showing results 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.

Regular Visitor

## Using DISTINCTCOUNT to find distinct names in table

I have a table with the following setup:

 Team name skill rating database john smith SQL server 3 database john smith DAX 3 database jimmy plank SQL Server 2 engineering susie q ETL 2 engineering susie q SQL 3 engineering issac walker ETL 1

There are about 50 skills per person. And there are a varying number of people on each team. I am trying to write a DAX measure to count the distinct amount of employees on each team. Any suggestions?

2 ACCEPTED SOLUTIONS
Solution Sage

Hi:

If your table name = Team  then

DC Team =
var teamname = SELECTEDVALUE(Team[Team])
return
CALCULATE(DISTINCTCOUNT(Team[name]), FILTER(ALL(Team),
Team[team] = teamname))

Solution Sage

Hi:

Yes:

Dist CT =
CALCULATE(
DISTINCTCOUNT(Team[name]),
FILTER(ALL(Team),Team[Team] = EARLIER(Team[Team])))

6 REPLIES 6
Solution Sage

Hi:

If your table name = Team  then

DC Team =
var teamname = SELECTEDVALUE(Team[Team])
return
CALCULATE(DISTINCTCOUNT(Team[name]), FILTER(ALL(Team),
Team[team] = teamname))

Regular Visitor

This is what I am looking for. is there anyway to add this value to the source table as a column?

Solution Sage

Hi:

Yes:

Dist CT =
CALCULATE(
DISTINCTCOUNT(Team[name]),
FILTER(ALL(Team),Team[Team] = EARLIER(Team[Team])))

Regular Visitor

Thank you so much!

Super User

Hi,

Please check the below picture and the attached pbix file.

``````Employee count in each team: =
DISTINCTCOUNT(Data[name])``````

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.

Solution Sage

Hi Jihwan:

I'm sorry if I answered after you. I did not see any answer yet when I answered. Thank you..

Announcements

#### 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

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors