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
user900
Helper II
Helper II

Distinct Count across all departments

For distinct count of employees, I'm using the following measure in a card:

calculate(DISTINCTCOUNT('Table'[Emp ID])
In addition to this, I need to show a breakdown by department, but when I use the same measure with department on the x-axis, the count is higher. I think it's because one employee could appear in multiple departments due to transferring sometime throughout the year.  
Is there a way to get distinct count of employee ID across all departments?
 
Please and thanks
1 ACCEPTED SOLUTION

hi @user900 

sorry it is a typo, it is VAR

View solution in original post

8 REPLIES 8
FreemanZ
Super User
Super User

hi @user900 

 

do you mean count an employee at the last department only?

yes

hi @user900 

try like:

Count =
VAR _table1 =
ADDCOLUMNS(
    SUMMARIZE(
         TableName,
         TableName[EmpID],
         TableName[Department]
    ),
    "Date",
    CALCULATE(MAX(TableName[Date]))
)
VAT _table2 =
TREATAS(
     _table1,
    TableName[EmpID],
    TableName[Department],
    TableName[Date]
)
RETURN
COUNTROWS(_table2)
 
in case of issue, please consider paste some sample data and @me

I applied as you suggested.

I'm not familiar with VAT so I don't know how to troubleshoot this error: The syntax for 'VAT_table2' is incorrect.   Can you help?

hi @user900 

sorry it is a typo, it is VAR

One more question.  Of that same population broken down by department, can I add a filter?  I also need to show whether the employee passed or failed a course.

hi @user900 

Filtering on other dimension shall still work. Just try and let us know. 

Works perfectly.  Thank you so much!

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.