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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
villa1980
Resolver II
Resolver II

Working Days For Full Month But Don't Have Full Days In Month

Hi all,

 I am trying to create a working days measure for the full month within a table (not created by myself) that has a date field but contains the date range from 1st Jan 24 to yesterday (12th Feb 25).

 What I would like to do is show the working day for the full month of Feb (1st - 28th) or any other month even if it does not have the full date range in.

 Do I create a seperate table with the full date range in??


Thanks

Alex 

3 ACCEPTED SOLUTIONS
ToddChitt
Super User
Super User

Yes, I suggest you have a full Date dimension table. In there you can put in a DAX calculated column to specify that if the week day is Monday through Friday then it is a working day, otherwise not. Make this column a 1 or 0 integer. Then you can set up a simple Measure of "Month To Date Working Days" = TOTALMTD ( SUM ( [Working Day] ), 'Dates'[Date] ).

If you also have a measure of something like MTD Sales or MTD Production, you can get Average Production Per Day by dividing the two: DIVIDE ( [MTD Production], [MTD Working Days] )

 

Hope this helps.




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





View solution in original post

Bibiano_Geraldo
Super User
Super User

Hi @villa1980 ,
Yes, it's best practice to create a separate calendar (date) table that includes the full date range you need. A dedicated date table lets you define attributes (like working day flags, month names, etc.) and easily filter or slice your data by any date component. 

Power BI’s best practices recommend using a calendar table to drive time intelligence calculations, ensuring that your measures (like working days) are consistent across any period even when the fact table has gaps.

So, in short: Yes, create a separate table with the full date range to accurately calculate and display working days for any month.

View solution in original post

Fowmy
Super User
Super User

@villa1980 

It is always the best practice to create your dates table with full year dates. However, if you need to get the Working days even if the month is not complete, use this measure on a table visual

 

Working Days =
VAR __CurrentDate =
    MAX ( 'dates'[date] )
VAR __FullMonth =
    CALENDAR ( EOMONTH ( __CurrentDate, -1 ) + 1, EOMONTH ( __CurrentDate, 0 ) )
VAR __WorkingDays =
    COUNTROWS ( FILTER ( __FullMonth, NOT WEEKDAY ( [Date], 1 ) IN { 7, 1 } ) )
RETURN
    __WorkingDays

 








Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

4 REPLIES 4
villa1980
Resolver II
Resolver II

Thank-you all for your responses, has really helped with my query and worked very well.

 

Fowmy
Super User
Super User

@villa1980 

It is always the best practice to create your dates table with full year dates. However, if you need to get the Working days even if the month is not complete, use this measure on a table visual

 

Working Days =
VAR __CurrentDate =
    MAX ( 'dates'[date] )
VAR __FullMonth =
    CALENDAR ( EOMONTH ( __CurrentDate, -1 ) + 1, EOMONTH ( __CurrentDate, 0 ) )
VAR __WorkingDays =
    COUNTROWS ( FILTER ( __FullMonth, NOT WEEKDAY ( [Date], 1 ) IN { 7, 1 } ) )
RETURN
    __WorkingDays

 








Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Bibiano_Geraldo
Super User
Super User

Hi @villa1980 ,
Yes, it's best practice to create a separate calendar (date) table that includes the full date range you need. A dedicated date table lets you define attributes (like working day flags, month names, etc.) and easily filter or slice your data by any date component. 

Power BI’s best practices recommend using a calendar table to drive time intelligence calculations, ensuring that your measures (like working days) are consistent across any period even when the fact table has gaps.

So, in short: Yes, create a separate table with the full date range to accurately calculate and display working days for any month.

ToddChitt
Super User
Super User

Yes, I suggest you have a full Date dimension table. In there you can put in a DAX calculated column to specify that if the week day is Monday through Friday then it is a working day, otherwise not. Make this column a 1 or 0 integer. Then you can set up a simple Measure of "Month To Date Working Days" = TOTALMTD ( SUM ( [Working Day] ), 'Dates'[Date] ).

If you also have a measure of something like MTD Sales or MTD Production, you can get Average Production Per Day by dividing the two: DIVIDE ( [MTD Production], [MTD Working Days] )

 

Hope this helps.




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors