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

Calculate active/inactive employees in a month

Hello everyone!

 

I'm looking for the proper way to compute the number of people which becomes inactive in a month.

Particularities: I have people from different working centers. I am using a Calendar Table. I have three slicers: center, year, month.

My data is something like:

 

ID EmployeeStart dateEnd dateIsDown (T/F)Center
129/10/202203/06/2023True02
202/06/202305/06/2023True02
322/12/202207/06/2023True02
415/10/202018/06/2023True02
514/07/2021 False02
616/08/2022 False03
715/02/202005/06/2023True03

 

Therefore, if I filter in a slicer by year "2023" and other by month "June" in center 2 I should get 4 people.

 

Up to now, I have implemented these measure:

Inactives=CALCULATE(COUNTROWS('Employees'),USERELATIONSHIP('Calendar'[Date],'Employees'[EndDate]))

However, it results in incorrect numbers.

 

Thanks in advance

2 ACCEPTED SOLUTIONS
DoubleJ
Solution Supplier
Solution Supplier

Hi

Do you have an active relationship between your Dates and Employees using StartDate? My assumption is: When you use a year/month slicer, the center slicer only shows employees with a StartDate with the selected year and month.

You can use a separate Centers table to overcome this. Couldnt find a way to attach a file, so I hope the printscreen helps:

DoubleJ_0-1689850429008.png

 

DoubleJ_1-1689850543828.png

 



Hope I could help
JJ

View solution in original post

I was using also a Center table, and the relationship was inactive for both Start and End Date. For inactive, it was my fault with filters... 😅

Thank you anyway!!

View solution in original post

3 REPLIES 3
DoubleJ
Solution Supplier
Solution Supplier

Hi

Do you have an active relationship between your Dates and Employees using StartDate? My assumption is: When you use a year/month slicer, the center slicer only shows employees with a StartDate with the selected year and month.

You can use a separate Centers table to overcome this. Couldnt find a way to attach a file, so I hope the printscreen helps:

DoubleJ_0-1689850429008.png

 

DoubleJ_1-1689850543828.png

 



Hope I could help
JJ

I was using also a Center table, and the relationship was inactive for both Start and End Date. For inactive, it was my fault with filters... 😅

Thank you anyway!!

pceglie
Resolver I
Resolver I

Hi, in the visual (table I suppose) you have to add the measure you've created

pceglie_0-1689849996355.png

 

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.