Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I am building an attendance dashboard and already integrated holidays and weekends and a calculated column that calculated the durantion between the earliest entry and latest exit timestamps and everything checks out except for the "Attendance Status" calculated column where I am using the SWITCH function with all possible conditions but I am not getting the expected results as can be seen in the screenshot, when the day is "Regular" and the completed hours are equal or more than 8 then it should be fulfilled otherwise it is incomplete same with ramadan but the hours being 5 instead but I "Absent" and "Not Required" are the only results I am getting even when that is not the case. I tried to test out each condition individualy to troubleshoot but to no avail.
Below is the dax expression I used:
Solved! Go to Solution.
Hi @imbetto
What I can see, the issue might be that your SWITCH(TRUE()) logic is evaluating the hours before checking the special day types like Holiday, Weekend, etc. So even if it should be marked as “Holiday” or “Leave,” it’s defaulting to “Absent” too early.
One approach that’s worked for me in the past is to check all the special conditions first (like holidays, weekends, approved leave, etc.), and only then check the hours worked.
Here’s a cleaner structure you could try:
Attendance Status =
VAR Hrs = COALESCE('Attendance'[Completed Hours], 0)
VAR IsHoliday = RELATED('Calendar'[HolidayFlag]) = 1
VAR IsWeekend = RELATED('Calendar'[WeekendFlag]) = 1
VAR NotReq = RELATED('Calendar'[NotRequiredFlag]) = 1
VAR IsLeave = RELATED('Leave'[ApprovedLeaveFlag]) = 1
VAR IsSick = RELATED('Sickness'[SickFlag]) = 1
RETURN
SWITCH (
TRUE(),
NotReq, "Not Required",
IsHoliday, "Holiday",
IsWeekend, "Weekend",
IsLeave, "Leave",
IsSick, "Sick",
ISBLANK('Attendance'[Completed Hours]), "No Time",
Hrs >= 7.5, "Present",
Hrs >= 4, "Half Day",
Hrs > 0, "Partial",
"Absent"
)
This structure checks all special cases first and only then evaluates based on hours. It also handles blanks more safely using COALESCE.
One thing to double-check make sure the relationships to your Calendar and other lookup tables are active and working as expected
Hi @imbetto , 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.
Hi @imbetto , 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.
Hi @imbetto , 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.
Hi @imbetto
What I can see, the issue might be that your SWITCH(TRUE()) logic is evaluating the hours before checking the special day types like Holiday, Weekend, etc. So even if it should be marked as “Holiday” or “Leave,” it’s defaulting to “Absent” too early.
One approach that’s worked for me in the past is to check all the special conditions first (like holidays, weekends, approved leave, etc.), and only then check the hours worked.
Here’s a cleaner structure you could try:
Attendance Status =
VAR Hrs = COALESCE('Attendance'[Completed Hours], 0)
VAR IsHoliday = RELATED('Calendar'[HolidayFlag]) = 1
VAR IsWeekend = RELATED('Calendar'[WeekendFlag]) = 1
VAR NotReq = RELATED('Calendar'[NotRequiredFlag]) = 1
VAR IsLeave = RELATED('Leave'[ApprovedLeaveFlag]) = 1
VAR IsSick = RELATED('Sickness'[SickFlag]) = 1
RETURN
SWITCH (
TRUE(),
NotReq, "Not Required",
IsHoliday, "Holiday",
IsWeekend, "Weekend",
IsLeave, "Leave",
IsSick, "Sick",
ISBLANK('Attendance'[Completed Hours]), "No Time",
Hrs >= 7.5, "Present",
Hrs >= 4, "Half Day",
Hrs > 0, "Partial",
"Absent"
)
This structure checks all special cases first and only then evaluates based on hours. It also handles blanks more safely using COALESCE.
One thing to double-check make sure the relationships to your Calendar and other lookup tables are active and working as expected
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...