Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Multiples dates in one table

Hi

 

I have the following problem. I have a table with information of all the employees who are active and inactive of the company. In this table i have a date of admission and for those inactive employees date of leave. I want to have a visualization that shows de increase of employees through months. Example table information:

IDEmployeeDate of admissionDate of leaveActive
1Juan1/1/2019 Yes
2Maria7/6/2003 Yes
3Pedro6/5/20207/6/2022No
4Ulises6/8/20188/5/2021No
5Roberto7/9/2019 Yes
6Lucia2/3/2015 Yes

 

Dax formula i used:

Headcount = CALCULATE(DISTINCTCOUNT(Empleados[Employee]), Empleados[Active] ="Yes")

Historic Headcount=

CALCULATE(
    [Headcount],
    FILTER(
        ALLSELECTED('Date'[Date]), 'Date'[Date] <= MAX ('Date'[Date])
        
    ))
 
I have a Date table relation with Date of Admission o Employee table. Anda i have an INACTIVE relation between Date of Leave and Date table.
When i show the visualization i realise that de cummulative headcount in time it is only counting for each mont employees that enter the company. So the number is always increasing. It doesent count in each month the employees which where active in a mont but now they are not active because they leave
Please Help

Thanks!

4 Replies