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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
PatLam0187
New Member

Calculate Active Employees with only 1 Date Column

Hello,

 

I am trying to calculate for the total number of Active employees and YoY growth.

 

The challenge I am facing is that my data is not commonly arranged arranged as I am using just 1 date column.


The data is structured like this and is connected to a Date Dimension table called [DateDim]

 

Employee IDStatusBegin DateAction

1001

Active2022-06-20New Hire
1001

Active

2023-10-27Leave of Absence
1001Active2024-12-04Return to Work

1001

Terminated2025-01-13Termination
1001Active2022-06-05Rehire
1002Active2022-06-20New Hire
1003Active2025-02-10New Hire
1004Active2025-06-01New Hire
1005Active2022-05-20New Hire
1005Active2023-02-20Change in Position
1005Terminated2025-05-15Termination

 

Thank you

6 REPLIES 6
v-lgarikapat
Community Support
Community Support

Hi @PatLam0187 ,

Thanks for reaching out to the Microsoft fabric community forum.

@ryan_mayu ,

@SamsonTruong ,

Thanks for your prompt response

 

I have implemented the required logic and uploaded a sample PBIX file for your review. Kindly have a look and let me know if any adjustments or additional changes are needed.

Looking forward to your feedback.

 

 

If this post helped resolve your issue, please consider the Accepted Solution. This not only acknowledges the support provided but also helps other community members find relevant solutions more easily.

We appreciate your engagement and thank you for being an active part of the community.

Best regards,
LakshmiNarayana
.

Hello @v-lgarikapat, the update you had provided is working when the filter/date slicer is not selected if I select 2025 for example it will not include the 2022 record and will only count who are active beggining 2025. It should include the active 2022 record. Thank you so much!

ryan_mayu
Super User
Super User

@PatLam0187 

will 1001 and 1002 be counted as active for year 2023 and beyond?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu Yes, it should be a cummulative count. Say I am filetring as of today, those that were active 2022 to present should be also counted as active. Hope that makes sense. Thank you.

SamsonTruong
Solution Supplier
Solution Supplier

Hi @PatLam0187 ,

This can be achieved with 2 measures.

The first measure would be to calculate the total number of Active employees and would be like so:

ActiveEmployees = 
VAR SelectedDate = MAX('DateDim'[Date])
VAR LatestActive =
    ADDCOLUMNS(
        SUMMARIZE(
            'EmployeeActions',
            'EmployeeActions'[EmployeeID],
            "LatestActionDate",
                CALCULATE(
                    MAX('EmployeeActions'[BeginDate]),
                    'EmployeeActions'[BeginDate]<=SelectedDate
                )
        ),
        "LatestActionStatus",
            CALCULATE(
                MAX('EmployeeActions'[Status]),
                FILTER(
                    'EmployeeActions',
                    'EmployeeActions'[EmployeeID]=EARLIER('EmployeeActions'[EmployeeID])
                    && 'EmployeeActions'[BeginDate]=EARLIER([LatestActionDate])
                )
            )
    )
RETURN
    COUNTROWS(
        FILTER(LatestActive,[LatestActionStatus]="Active")
    )


We can then use a second measure like below to calculate the YoY growth:

ActiveEmployeesYoY = 
VAR CurrentDate = MAX('DateDim'[Date])
VAR PrevYearDate = EDATE(CurrentDate,-12)
VAR CurrentValue =
    CALCULATE([ActiveEmployees],'DateDim'[Date]=CurrentDate)
VAR PrevYearValue =
    CALCULATE([ActiveEmployees],'DateDim'[Date]=PrevYearDate)
RETURN
    DIVIDE(CurrentValue-PrevYearValue,PrevYearValue)

 

If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.

Thanks,

Samson

 

Connect with me on LinkedIn

Check out my Blog

Going to the European Microsoft Fabric Community Conference? Check out my Session

Thank you, @SamsonTruong however this only counts those who were active as of date. I also need to include those who were active in the previous dates. Say someone is Active in 2023, that person should also be inlcuded in todays count. Thanks again.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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