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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Historical analysis and working with SCD type 2.

Hi All

I have an employee table which is SCD type 2, all record are overwritten when updated and I just have an change table that could track before and after values. In my data mode, I created a relationship between employee table and change table via employee id and here is an example of my tables;

Employee table:

samravp_2-1677460215702.png

 

Change Table:

samravp_1-1677460029361.png

I have added a dynamic slicer to my canvas and I want to calculate the number of full-time employees based on slicer date (for example: as at end of december 2022).

I wrote below dax to calculate number of the active employees as at end of slicer date;

ActiveEmployees=
COUNTROWS(
   FILTER (
        Employee,
        (Employee[StartDate] <= ENDOFMONTH(Dates[Date])
                    && Employee[TerminationDate] == BLANK () 
                       || 
                       Employee[commencementDate] <= ENDOFMONTH(Dates[Date])
                          && Employee[TerminationDate] > ENDOFMONTH(Dates[Date])
    ))

 

Now I want to calculate number of full-time employees, what's the best way to do this to incorporate the changes to status as per changes table?

 

Thanks in advance.

 
2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous ,

 

ActiveEmployees=
COUNTROWS(
FILTER (
Employee,
(Employee[StartDate] <= max(Dates[Date])
&& Employee[TerminationDate] == BLANK ()
||
Employee[commencementDate] <= max(Dates[Date])
&& Employee[TerminationDate] > mx(Dates[Date])
) && Employee[Status] = "FULL" ))

 

 

Power BI: HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

Anonymous
Not applicable

Hi @amitchandak 

Active employees dax works fine, I just need some ideas about the measure to bring in changes and caluculate the accurate number of full-time emloyees. for example to take into account employees that are currently full-time but they weren't full time back at the end of december 2022.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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