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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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