Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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?
Solved! Go to Solution.
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())
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)})
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
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())
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)})
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
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!
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
8 |
User | Count |
---|---|
13 | |
12 | |
11 | |
10 | |
8 |