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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.