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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MEHUL123
Frequent Visitor

DAX for percentage attendance in powerbi

Hi,

 

I have 2 tables,

1) Datetable (having date, months, years)

2) Employee roll wise and date wise attendance

 

I want to display %Attendance of each employee in output

i.e.  --  ideal work days (day count in excluding sunday on any specific month or combination of multiple months) vs actual worked days of any employee for that specific period

Let Say,

EMP_IDTOTAL work days of specific monthsActual Worked Days of employee on those months%Attendance
123262077%
345262181%
567262596%
7892627104%
TOTAL2623.2589%

 

However when i select multiple months (let say selection of Jan25 and Feb25 in filter), than i want sum of 2 month's work days,

means [26 work days (jan25)  + 24 work days (feb25)] = 50 work days total...

 

pls guide, thanks in advance.

 

1 ACCEPTED SOLUTION
rohit1991
Super User
Super User

Hi @MEHUL123

 

You can calculate dynamic percentage attendance by comparing the actual worked days (excluding Sundays) against the total possible working days. 

 

Step 1: Measure for Total Working Days (excluding Sundays)

TotalWorkingDays =
CALCULATE(
    COUNTROWS(DateTable),
    DateTable[DayName] <> "Sunday"
)

 

Step 2: Measure for Actual Worked Days (per employee)

ActualWorkedDays =
CALCULATE(
    COUNTROWS(AttendanceTable),
    AttendanceTable[Status] = "Present"  -- or whatever status indicates attendance
)

 

Step 3: Measure for % Attendance

% Attendance =
DIVIDE([ActualWorkedDays], [TotalWorkingDays], 0)

Make sure your DateTable is marked as a Date table and is properly related to the AttendanceTable on the date column. This setup will give you accurate, dynamic attendance percentages across any time period you slice by including combinations of months, quarters, or years.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

5 REPLIES 5
v-hashadapu
Community Support
Community Support

Hi @MEHUL123 , Please let us know if your issue is solved. If it is, consider marking the answer that helped 'Accept as Solution', so others with similar queries can find it easily. If not, please share the details.
Thank you.

v-hashadapu
Community Support
Community Support

Hi @MEHUL123 , Please let us know if your issue is solved. If it is, consider marking the answer that helped 'Accept as Solution', so others with similar queries can find it easily. If not, please share the details.
Thank you.

v-hashadapu
Community Support
Community Support

Hi @MEHUL123 , Please let us know if your issue is solved. If it is, consider marking the answer that helped 'Accept as Solution', so others with similar queries can find it easily. If not, please share the details.
Thank you.

rohit1991
Super User
Super User

Hi @MEHUL123

 

You can calculate dynamic percentage attendance by comparing the actual worked days (excluding Sundays) against the total possible working days. 

 

Step 1: Measure for Total Working Days (excluding Sundays)

TotalWorkingDays =
CALCULATE(
    COUNTROWS(DateTable),
    DateTable[DayName] <> "Sunday"
)

 

Step 2: Measure for Actual Worked Days (per employee)

ActualWorkedDays =
CALCULATE(
    COUNTROWS(AttendanceTable),
    AttendanceTable[Status] = "Present"  -- or whatever status indicates attendance
)

 

Step 3: Measure for % Attendance

% Attendance =
DIVIDE([ActualWorkedDays], [TotalWorkingDays], 0)

Make sure your DateTable is marked as a Date table and is properly related to the AttendanceTable on the date column. This setup will give you accurate, dynamic attendance percentages across any time period you slice by including combinations of months, quarters, or years.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!
AnkitKukreja
Super User
Super User

Hi! @MEHUL123 

 

I think you are looking for this, if this doesn't help please do share a sample file.
https://www.youtube.com/watch?v=k0I-khGGXE4

 

 

For Power BI trainings or support dm or reach out to me on LinkedIn.
If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.

Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.