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!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi,
I have a report of employees' attendance in the office.
To calculate the percent of working days that they attended correctly, I need to calculate how many working days they have in potential. So I have to require a calendar of working days and their hire date and their end date.
The formula I used is working perfectly for an employee granularity and incorrect for averages of all organization levels/managers/divisions etc...
I will thank if somebody can help me to fix the last part of the formula to get the correct average.
I also put the PBIX with an example here:
https://drive.google.com/file/d/1UU-u3Z0xjU0MqPrC_RoRLhyvI1ksmYrC/view
Solved! Go to Solution.
@Ritaf I just tidy it up a bit and it is working, maybe tweak it further as you see fit
Workdays Final =
VAR __min = MIN ( 'Calendar'[date] )
VAR __max = MAX ( 'Calendar'[date] )
RETURN
AVERAGEX (
employeesTable,
VAR start_day = MAX ( 'employeesTable'[StartEmpoyeeDate], __min )
//if('employeesTable'[StartEmpoyeeDate]>__min,'employeesTable'[StartEmpoyeeDate],__min)
VAR end_day = COALESCE ( MIN ( 'employeesTable'[LastEmpoyeeDate], __max ), __max )
//if (ISBLANK( 'employeesTable'[LastEmpoyeeDate]), __max,if('employeesTable'[LastEmpoyeeDate] > __max,__max,'employeesTable'[LastEmpoyeeDate]))
VAR workdays =
CALCULATE (
COUNTROWS ('Calendar' ),
'Calendar'[Date] >= start_day,
'Calendar'[Date] <= end_day,
'Calendar'[WorkdayFlag] = 1
)
RETURN
workdays
)
. You can remove those commented lines once you are happy with the result
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Ritaf I just tidy it up a bit and it is working, maybe tweak it further as you see fit
Workdays Final =
VAR __min = MIN ( 'Calendar'[date] )
VAR __max = MAX ( 'Calendar'[date] )
RETURN
AVERAGEX (
employeesTable,
VAR start_day = MAX ( 'employeesTable'[StartEmpoyeeDate], __min )
//if('employeesTable'[StartEmpoyeeDate]>__min,'employeesTable'[StartEmpoyeeDate],__min)
VAR end_day = COALESCE ( MIN ( 'employeesTable'[LastEmpoyeeDate], __max ), __max )
//if (ISBLANK( 'employeesTable'[LastEmpoyeeDate]), __max,if('employeesTable'[LastEmpoyeeDate] > __max,__max,'employeesTable'[LastEmpoyeeDate]))
VAR workdays =
CALCULATE (
COUNTROWS ('Calendar' ),
'Calendar'[Date] >= start_day,
'Calendar'[Date] <= end_day,
'Calendar'[WorkdayFlag] = 1
)
RETURN
workdays
)
. You can remove those commented lines once you are happy with the result
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Ritaf this is what I see, there are 3 files, if you just give me the file name, it will be easier. 😁
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
sorry it's named SampleFile.pbix
maybe this link will take you to the right place
https://drive.google.com/file/d/1UU-u3Z0xjU0MqPrC_RoRLhyvI1ksmYrC/view?usp=sharing
@Ritaf there are few files which one to use?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
if you press download it takes only one PBIX.
I really don't know why it showing multiple files
@Ritaf hmmm, can you share a sample pbix file, remove sensitive information before sharing.
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi,
thanks for responding
I put a PBIX with an example here
https://drive.google.com/drive/folders/180w1__xEBq31goTDTM_gOOK_Y7MUzHkq?usp=sharing
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 49 | |
| 35 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 92 | |
| 75 | |
| 41 | |
| 26 | |
| 25 |