Forum Discussion

spandy34's avatar
spandy34
Icon for Responsive Resident rankResponsive Resident
5 months ago
Solved

DAX for Financial Year Running Report Employee

I have a Main Employee table that consists Personid, EmpStartDate and EmpEndDate.  I need to create a graph that counts the distinct personid for employees in that financial year that were employeed ...
  • danextian's avatar
    5 months ago

    Hi spandy34 

    Assuming that in your employee table each employee only has one record and making sure that the date table is disconnected from the employee table, try this:

    Count by Time Period =
    VAR StartDate =
        MIN ( Dates[Date] )
    VAR EndDate =
        MAX ( Dates[Date] )
    RETURN
        COUNTROWS (
            FILTER (
                EmpData,
                EmpData[EmpStartDate] <= EndDate
                    && (
                        ISBLANK ( EmpData[EmpEndDate] ) || EmpData[EmpEndDate] >= StartDate
                    )
            )
        )
    

    Please see the attached pbix.