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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
CiaraCaryl
Frequent Visitor

Number of Workdays per Month

I need to calculate the number of work days per month for some margin and revenue data.

Essentially the invoice date I am using should only include work days, no holidays or weekends. 

What formula can I use that would return the number of distinct invoice dates per month?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @CiaraCaryl ,

If you want to return the working days of the month (excluding weekends and holidays) please see this test.
In my scenario:

My Table:

Table = CALENDAR(DATE(2024,1,1),TODAY())

vyetonggumsft_0-1724642235258.png

workdays =

VAR _start = DATE(YEAR(MAX([Date])), MONTH(MAX([Date])), 1)

VAR _last = EOMONTH(_start, 0)

RETURN

NETWORKDAYS(_start, _last, 1, {DATE(2024, 1, 1), DATE(2024, 12, 31)})

vyetonggumsft_1-1724642235266.png

I set the weekend to Saturday and Sunday, which is represented as 1 in the NETWORKDAYS function.

For more details, you can read related document link:

NETWORKDAYS function (DAX) - DAX | Microsoft Learn

 

Best Regards,

Sunshine Gu

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @CiaraCaryl ,

If you want to return the working days of the month (excluding weekends and holidays) please see this test.
In my scenario:

My Table:

Table = CALENDAR(DATE(2024,1,1),TODAY())

vyetonggumsft_0-1724642235258.png

workdays =

VAR _start = DATE(YEAR(MAX([Date])), MONTH(MAX([Date])), 1)

VAR _last = EOMONTH(_start, 0)

RETURN

NETWORKDAYS(_start, _last, 1, {DATE(2024, 1, 1), DATE(2024, 12, 31)})

vyetonggumsft_1-1724642235266.png

I set the weekend to Saturday and Sunday, which is represented as 1 in the NETWORKDAYS function.

For more details, you can read related document link:

NETWORKDAYS function (DAX) - DAX | Microsoft Learn

 

Best Regards,

Sunshine Gu

ahadkarimi
Solution Specialist
Solution Specialist

Hi @CiaraCaryl , try two measures below, and if you encounter any issues, let me know.

 

Workdays = 
CALCULATE(
    COUNTROWS('InvoiceTable'),
    FILTER(
        'InvoiceTable',
        WEEKDAY('InvoiceTable'[InvoiceDate],2) <= 5 && 
        NOT('InvoiceTable'[InvoiceDate] IN VALUES('HolidayTable'[HolidayDate]))
    )
)
Distinct Workdays per Month = 
CALCULATE(
    DISTINCTCOUNT('InvoiceTable'[InvoiceDate]),
    FILTER(
        'InvoiceTable',
        WEEKDAY('InvoiceTable'[InvoiceDate],2) <= 5 && 
        NOT('InvoiceTable'[InvoiceDate] IN VALUES('HolidayTable'[HolidayDate]))
    )
)

 

 

Did I answer your question?  If so, please mark my post as the solution!✔️
Your Kudos are much appreciated!  Proud to be a Responsive Resident!

lbendlin
Super User
Super User

There is no need to calculate this in Power BI. This data is immutable.  Use an external reference table where you precomputed that stuff once.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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