cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

## Calculate number of working days in current month

Hi,

I am having a hard time figuring how to calculate the number of working days already passed since the beginning of the month, as of today.  The number should dynamically change everyday as a result.

I have tried using a Calendar table to differentiate the type of days, but I am lost in the way to make it work in the end, and I wonder if there isn't just a simple way to do this..

Thanks !

1 ACCEPTED SOLUTION
Employee

Hi @mperrot,

I forgot to change it.

```count working days =
CALCULATE (
COUNTROWS ( 'Dim table' ),
FILTER (
'Dim table',
'Dim table'[Date].[Day] <= DAY ( TODAY () )
&& 'Dim table'[Date].[MonthNo] = MONTH ( TODAY () )
&& 'Dim table'[Weekday] <= 5
)
)```

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
8 REPLIES 8
Employee

Hi @mperrot,

Create a calendar table which lists unique continual dates, and add a calculated column to show weekday number for each date.

`Weekday = WEEKDAY('Dim table'[Date],2)`

Then, create a measure to get the number of working days already passed since the beginning of the month, as of today.

```count working days =
CALCULATE (
COUNTROWS ( 'Dim table' ),
FILTER (
'Dim table',
'Dim table'[Date].[Dia] <= DAY ( TODAY () )
&& 'Dim table'[Date].[MonthNo] = MONTH ( TODAY () )
&& 'Dim table'[Weekday] <= 5
)
)```

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

This is what  your solution is returning. Could you help me out here?

Helper III

I am also unable to enter any of my column names (mine are called dayofmonth and monthofyear) into the formula - what am I doing wrong?

count working days =
CALCULATE (
COUNTROWS ( 'Date table' ),
FILTER (
'Date table',
'Date table'[Date].[Dayofmonth] <= DAY ( TODAY () )
&& 'Date table'[Date].[Monthofyear] = MONTH ( TODAY () )
&& 'Date table'[Weekday] <= 5
)
)
Frequent Visitor

What are [Dia] and [MonthNo] referring to ? I get a message telling me they cannot be found in the Date Column

Employee

Hi @mperrot,

I forgot to change it.

```count working days =
CALCULATE (
COUNTROWS ( 'Dim table' ),
FILTER (
'Dim table',
'Dim table'[Date].[Day] <= DAY ( TODAY () )
&& 'Dim table'[Date].[MonthNo] = MONTH ( TODAY () )
&& 'Dim table'[Weekday] <= 5
)
)```

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I have that formula in my calendar. However, we report as of the prior day. On the first of the month I need to count total working days as of last month.

Example: Today is October 1 (22 working days). But, we are reporting September (21 working days).

The below does not work for me for total work days in the reporting period month. But it does when counting actual work days past in the month:

working_days =
CALCULATE ( COUNTROWS ( BI_Calendar ),
FILTER ( BI_Calendar,
AND( BI_Calendar[Month] = MONTH( TODAY () -1 ) ,
not WEEKDAY( BI_Calendar[Day of Week]) in {1,7}
) ))

NOTE: The sales Table contains a field [CalendatKey] which is a date (links to [CalendarDate] ) but it is not
Non Contiguous.

Thank you and I give KUDOS and mark as solved!
Post Patron

Hi iam working through this sme problem. I have calculated the number of working days er month. Happy with that.

`'Dim table'[Date].[Day] <= DAY ( TODAY () )`

what is the [Date].[Day] as I do not get that option. is it a column in your date table? If so what format?

when I select my weekday  (ie the column <=5) I get a returned value that is the same as the total for the month. today is the 15th, so it can not return 22 for April, which is what I am currently getting. But I can not put the dax exactly as you have it as I dont have [day]. Is it just 1 to 30?

Frequent Visitor

Thank you so much for your help ! Have a great day 🙂

Announcements

#### Fabric certifications survey

Certification feedback opportunity for the community.

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors