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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
mstefancik
Advocate IV
Advocate IV

Networkdays DAX function

Hello,

can somebody help me? Is there any simple method how to calculate Working Days left in actual month?

In excel I am using NETWORKDAYS function.

 

Any example?

 

Thanks

1 ACCEPTED SOLUTION

Try something like this:

 

WD = VAR WDinMonth = CALCULATE(COUNTROWS('Calendar');
FILTER('Calendar'; 'Calendar'[DayOfWeekNumber] >= 1
&& 'Calendar'[DayOfWeekNumber] <= 5 ))

VAR WDinMonthThusFar = CALCULATE(COUNTROWS('Calendar');
FILTER('Calendar'; 'Calendar'[DayOfWeekNumber] >= 1
&& 'Calendar'[DayOfWeekNumber] <= 5 ) && 'Calendar'[Date] < TODAY())

RETURN (WDinMonth -WDinMonthThusFar)

I'm assuming you have some sort of [Date] column in your table.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

7 REPLIES 7
ankitpatira
Community Champion
Community Champion

@mstefancik Check out this blog post. It may be what you want.

This is what I found, and tried to replicate. At this time I have got this:

 

WD = CALCULATE(COUNTROWS('Calendar');
FILTER('Calendar'; 'Calendar'[DayOfWeekNumber] >= 1
&& 'Calendar'[DayOfWeekNumber] <= 5 ))

 

Which works fine. It returns count of working days in month.

But how to filter it, to get the count of working days till the end of the month?

So to show me for today: 5 working days, tommorow 4 working days, etc

Try something like this:

 

WD = VAR WDinMonth = CALCULATE(COUNTROWS('Calendar');
FILTER('Calendar'; 'Calendar'[DayOfWeekNumber] >= 1
&& 'Calendar'[DayOfWeekNumber] <= 5 ))

VAR WDinMonthThusFar = CALCULATE(COUNTROWS('Calendar');
FILTER('Calendar'; 'Calendar'[DayOfWeekNumber] >= 1
&& 'Calendar'[DayOfWeekNumber] <= 5 ) && 'Calendar'[Date] < TODAY())

RETURN (WDinMonth -WDinMonthThusFar)

I'm assuming you have some sort of [Date] column in your table.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hello,

 

If I have dates in the below format and  there is a condition that I can not use calendar table,

How would I calculate networking days in a period, 

Please see data carefully below,

 

 community.PNG

 

I have period, start date and end date and i want to calculate networking days between these 2 dates in power bi, how can I do that...

Thanks in advance

Hi @Greg_Deckler exactly, I have got Date column in my Kalendar table.

So I should be able just copy your code. That is what I did, but got the error:

 

Capture2.PNG

Do I need to adjust something?

Already found it and now it works like a charm. Many thanks @Greg_Deckler.

 

FYI error was in the second filter, mismatch of parenthesis.

WD = VAR WDinMonth = CALCULATE(COUNTROWS('Kalendar');
FILTER('Kalendar'; 'Kalendar'[DayOfWeekNumber] >= 1
&& 'Kalendar'[DayOfWeekNumber] <= 5 ))

 

VAR WDinMonthThusFar = CALCULATE(COUNTROWS('Kalendar');
FILTER('Kalendar'; 'Kalendar'[DayOfWeekNumber] >= 1
&& 'Kalendar'[DayOfWeekNumber] <= 5 && 'Kalendar'[Date] < TODAY()))

 

RETURN (WDinMonth -WDinMonthThusFar)

 

 

Anonymous
Not applicable

Can we get this to exclude holidays?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.