Forum Discussion

waffle85's avatar
waffle85
Regular Visitor
6 years ago
Solved

Counting Full Time Employees By Week

Hi all. I have a fair amount of experience with Tableau, but just switched to Power BI. I have a table that includes Employee, Hours, and Date Worked. I'm trying to calculate what percent of full tim...
  • mahoneypat's avatar
    6 years ago

    The best way to do this would be to make a Date table (https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/) with a Week column, with a 1:Many relationship with your original table (called Hours, for example).  You can then write a measure like this to go in a visual with your week column.

     

    Total Employees =
    VAR summarytable =
        SUMMARIZE (
            Hours,
            Hours[Employee],
            'Date'[Week],
            "@HoursWorked", SUM ( Hours[Hours] )
        )
    RETURN
        SUMX ( summarytable, IF ( [@HoursWorked] < 40, [@HoursWorked] / 40, 1 ) )

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat