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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
puru85
Helper II
Helper II

Workday calculation

Hi Experts,

I have requirement to calculate workday per month. 

The Logic for workday calculation is:
Number of days per month minus public holidays, Saturdays, and Wednesdays. If a public holiday falls on a Wednesday, it should be additionally subtracted.

In the Master calender. I have a sepearet column to identify IsHoliday, IsSaturday and IsWednesday.

Attahced is the PBIX

Workdays.pbix

Thank you!



1 ACCEPTED SOLUTION

Hi @puru85 
Modify the formula of column isworkday to :

Not work day =
 
 IF('MasterCalendar'[Date] IN VALUES('Public Holiday'[Date]) && MasterCalendar[Weekday Number] =4,2,
 IF('MasterCalendar'[Date] IN VALUES('Public Holiday'[Date]) ||  MasterCalendar[Weekday Number] =7 ||  MasterCalendar[Weekday Number] =4,1,0
 ))
Ritaf1983_0-1721208352827.png

Result :

Ritaf1983_1-1721208386852.png
modified pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

5 REPLIES 5
puru85
Helper II
Helper II

Hi @Ritaf1983 @mickey64 @ryan_mayu ,

Thank you for helping me.
The measure you have created is calculating:
Number of days per month minus public holidays, Saturdays, and Wednesdays.

But requirement is:
Number of days per month minus public holidays, Saturdays, and Wednesdays. If a public holiday falls on a Wednesday, it should be additionally subtracted.

Please refer to below Master Calender Table for May 2024.

1 May and 22 May is Public Holiday which falls on Wednesday so it should be additionally subtracted.

So the number of working days for May 2024 will be: 20.

puru85_0-1721192771483.png

 

Ritaf1983
Super User
Super User

Hi @puru85 

You can add column to the calender like :

Not work day =
 IF('MasterCalendar'[Date] IN VALUES('Public Holiday'[Date]) ||  MasterCalendar[Weekday Number] =7 ||  MasterCalendar[Weekday Number] =4,1,0)
And measure :
Workdays count Rita = COUNTROWS('MasterCalendar')-sum('MasterCalendar'[Not work day])
Result:
Ritaf1983_0-1721187697915.png

The pbix is attached

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi @puru85 
Modify the formula of column isworkday to :

Not work day =
 
 IF('MasterCalendar'[Date] IN VALUES('Public Holiday'[Date]) && MasterCalendar[Weekday Number] =4,2,
 IF('MasterCalendar'[Date] IN VALUES('Public Holiday'[Date]) ||  MasterCalendar[Weekday Number] =7 ||  MasterCalendar[Weekday Number] =4,1,0
 ))
Ritaf1983_0-1721208352827.png

Result :

Ritaf1983_1-1721208386852.png
modified pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
mickey64
Super User
Super User

Step 0: I use your PBIX file.

 

Step 1: I make 3 measures below.

M_All Days = COUNTROWS('MasterCalendar')

M_Holiday_Wed_Sat = COUNTROWS(FILTER('MasterCalendar','MasterCalendar'[IsHoliday]=TRUE()||'MasterCalendar'[IsSaturday]=TRUE()||'MasterCalendar'[IsWednesday]=TRUE()))

M_Workdays = [M_All Days]-[M_Holiday_Wed_Sat]

 

Step 2: I make a matrix below.

mickey64_0-1721187450293.png

 

 

ryan_mayu
Super User
Super User

@puru85 

is this what you want?

 

Measure = COUNTROWS('MasterCalendar')-CALCULATE(COUNTROWS(MasterCalendar),FILTER(MasterCalendar,MasterCalendar[Weekday]="Wednesday"))-CALCULATE(COUNTROWS('Public Holiday'),FILTER('Public Holiday','Public Holiday'[Date]<=min('MasterCalendar'[Date])&&'Public Holiday'[Date]<=max('MasterCalendar'[Date])))
 
11.PNG




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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