Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello,
I have some strugle while calculating the comulative total active employee by year.
There are two tables:
Two realtionships:
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.
there is a sample pbix file: https://www.dropbox.com/s/kh7cj7cjbpy2oih/Employee%20count.pbix?dl=0
Could anyone help me with this issue?
Solved! Go to Solution.
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]))
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.
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]))
User | Count |
---|---|
84 | |
76 | |
74 | |
49 | |
39 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |