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
Anonymous
Not applicable

Comulative total of employee

Hello,

 

I have some strugle while calculating the comulative total active employee by year.

 

Screenshot_31.png

There are two tables:

  • Employee (No, Data_Joined, Data_Left)
  • Calendar (Date, Year)

Two realtionships:

  • Active: Employee[Data_joined], Calendar[Date]
  • Not active: Employee[Data_left], Calendar[Date]

 

I have created two measures:

Total emplyee = 
    CALCULATE(
        COUNTA(Employee[No_]);
        FILTER(ALL('Calendar');
       'Calendar'[Date]<=MAX('Calendar'[Date])))
Left Employee = 
    CALCULATE(
        COUNTA(Employee[No_]);
        FILTER(ALL('Calendar');
       'Calendar'[Date]<=MAX('Calendar'[Date]));USERELATIONSHIP(Employee[Data_Left];'Calendar'[Date]))

But something wrong with left employee calculations.

Screenshot_30.png

there is a sample pbix file: https://www.dropbox.com/s/kh7cj7cjbpy2oih/Employee%20count.pbix?dl=0

Could anyone help me with this issue?

 

 

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Anonymous 

Try this small change for your second measure:

Left Employee = 
    CALCULATE(
        COUNTA(Employee[Data_Left]);
        FILTER(ALL('Calendar');
       'Calendar'[Date]<=MAX('Calendar'[Date]));USERELATIONSHIP(Employee[Data_Left];'Calendar'[Date]))

View solution in original post

4 REPLIES 4
Gopal30
Helper I
Helper I

I am not sure if you are looking for thisCapture.PNG

 

 

 
Left Employee =
CALCULATE(
COUNTA(Employee[No_]),
FILTER(ALL('Calendar'),
'Calendar'[Date]<=MAX('Calendar'[Date])),FILTER(Employee,Employee[Data_Left]))
Anonymous
Not applicable

Thanks, @Gopal30

But I need to calculate amount of employee by the date they left, not by the date that the fired empyeewas hired.

For example:

In 2011 year, there where 71 employees but non of them left the company, so total active employee number should be 71.

In 2012 there where 3 new employees and one left, so total comulative emplyees should be 74 of emplyes and one left. Toatal amount of active employees 71+3-1 =73  and so on.

AlB
Community Champion
Community Champion

Hi @Anonymous 

Try this small change for your second measure:

Left Employee = 
    CALCULATE(
        COUNTA(Employee[Data_Left]);
        FILTER(ALL('Calendar');
       'Calendar'[Date]<=MAX('Calendar'[Date]));USERELATIONSHIP(Employee[Data_Left];'Calendar'[Date]))
Anonymous
Not applicable

Thanks, @AlB , it worked!

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.