Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Get absenteeism percent KPI

I have one payroll excel export that shows if an employee worked on a particular day.

I am trying to have 3 KPI showing absenteeism for last week, last month, and last quarter.

If a particular employee worked more than 40 hours for a week then it is considered full attendance (100%) for that week. 

I created a measure that partially works because it doesnt looks at an individual week. I also cant group them and show it on a card.

 

Absenteeism =

1-DIVIDE(MIN(SUM(Payroll[Total Hrs]),40*DISTINCTCOUNT(Payroll[Weekend])),40*DISTINCTCOUNT(Payroll[Weekend]))

 

Data link

https://drive.google.com/file/d/1r4yMtAMG425b8_lOLSkOeYiF0zE2bUgo/view?usp=sharing

 

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Based on your discussion with @amitchandak  above, I would suggest modifying your measures like below. It will calculate the absenteeism based on hours.

Absenteeism = 
VAR absentWeeksTable =
    FILTER (
        SUMMARIZE (
            Payroll,
            Payroll[Emp No],
            Payroll[Weekend],
            "_1", SUM ( Payroll[Total Hrs] )
        ),
        [_1] < 40
    )
VAR absentWeeks = COUNTX ( absentWeeksTable, [Weekend] )
VAR allWeeks = DISTINCTCOUNT ( Payroll[Weekend] )
VAR hrs = SUMX ( absentWeeksTable, [_1] ) + ( allWeeks - absentWeeks ) * 40
RETURN
    1 - DIVIDE ( MIN ( hrs, 40 * allWeeks ), 40 * allWeeks )

 011401.jpg

Kindly let me know if this helps.
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Based on your discussion with @amitchandak  above, I would suggest modifying your measures like below. It will calculate the absenteeism based on hours.

Absenteeism = 
VAR absentWeeksTable =
    FILTER (
        SUMMARIZE (
            Payroll,
            Payroll[Emp No],
            Payroll[Weekend],
            "_1", SUM ( Payroll[Total Hrs] )
        ),
        [_1] < 40
    )
VAR absentWeeks = COUNTX ( absentWeeksTable, [Weekend] )
VAR allWeeks = DISTINCTCOUNT ( Payroll[Weekend] )
VAR hrs = SUMX ( absentWeeksTable, [_1] ) + ( allWeeks - absentWeeks ) * 40
RETURN
    1 - DIVIDE ( MIN ( hrs, 40 * allWeeks ), 40 * allWeeks )

 011401.jpg

Kindly let me know if this helps.
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

amitchandak
Super User
Super User

@Anonymous , Yet to check your file

I taken a bit different approch, I am counting employee and week.

 

Measure = 1- divide( Countx(Filter(Summarize(payroll, payroll[employee], Payroll[Weekend],"_1", SUM(Payroll[Total Hrs])),[_1] >=40), [Employee]) ,
Countx(Summarize(payroll, payroll[employee], Payroll[Weekend]),[Employee]))

 

Here each employee will counted once per week. Please change column name as per need

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

This is great! 

The only problem is if an employee works for 33.50 hours, it counts as if the employee is absent for the entire week.

Below is example for employee #26, for the past 8 weeks, they only missed 14.5 hours/320 = 0.0453 and not 25% which is missing 2 weeks out of 8

 

image.png

 

@Anonymous , Try using hours in place of count 🤔

 


Measure = 1- divide( Countx(Filter(Summarize(payroll, payroll[employee], Payroll[Weekend],"_1", SUM(Payroll[Total Hrs])),[_1] >=40), [_1]) ,
Countx(Summarize(payroll, payroll[employee], Payroll[Weekend],"_1", SUM(Payroll[Total Hrs])),[_1]))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.