Forum Discussion
Workdays in current Month
I am trying to work out the number of work days in the current month.
I have a formula which works to show number of days in month, but how do I change this to just show weekdays?
8 Replies
- pbiuseruk
Resolver IV
There's a function called NETWORKDAYS.
These are the parameters NETWORKDAYS(<start_date>, <end_date>[, <weekend>, <holidays>]). By default it excludes weekends. You just need to do something like this:
NETWORKDAYS(<StartDateOfMonth>,<EndDateOfMonth>)- EmWy24Regular Visitor
Thank you, but unfortunately NETWORKDAYS is not an option in my version of Power BI 😞
- pbiuseruk
Resolver IV
Ahh, to be honest, I'd strongly recommend updating it or asking your admins to because that's crazy.
But if you can't then another way to do this (although I'm not the biggest fan of this), is to make a day column in Power Query (really simple to do - just select the date field in your calender table, then fo to add columns tab at the top, select the dates dropdown on the top right and then select Day).
^This will add a Day field to the calender table like Monday, Tuesday, etc..
Then in Power Query, make a conditional column and then say If Monday, then Weekday, If Tuesday, then Weekday, etc...
Then in your model, make sure that you do it in a way where you link the calendar table to any dates fields in other tables and then you'll be able to use that column as a filter in your pages.
Hope that makes sense.
- SachinNandanwar
Impactful Individual
IF(WEEKDAY([Date], 2) >= 6, TRUE(), FALSE())
- AnonymousNot applicable
Hi EmWy24 ,
It's not complicated to realize this I'll try to use the following DAX in a newly created date table to help you find the number of days worked in each month.Workdays = CALCULATE( COUNTROWS('DateTable'), 'DateTable'[Date] >= DATE(YEAR(TODAY()), MONTH(TODAY()), 1), 'DateTable'[Date] <= EOMONTH(TODAY(), 0), WEEKDAY('DateTable'[Date], 2) <= 5 )Below is the community Blog on how to find the number of working days, one of the real Power query to filter, I hope to help your question, if you have further questions, you can feel free to contact me, I will be the first time to reply when I receive your message!
Calculate the working days between two dates exclu... - Microsoft Fabric Community
Hope it helps!
Best regards,
Community Support Team_ Tom ShenIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- EmWy24Regular Visitor
Thank you for the response. Unfortunately this won't work for me, as I don't have a date table and can't have any tables. My source is through Analysis Services.
- pbiuseruk
Resolver IV
Hi,
Please try this - just tried it and it works for me.
CM_WorkdaysInCurrentMonth = var start_of_current_month = EOMONTH(today(),-1) + 1 var end_of_current_month = EOMONTH(today(),0) var calender_month_days = Filter(CALENDAR(start_of_current_month,end_of_current_month), WEEKDAY([Date],2)<6) RETURN COUNTROWS(calender_month_days)