cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bukhori
Frequent Visitor

Calculating Networkdays if it's blank in Power Query

Hi Everyone,

 

I would to calculate networkdays between the [Start] and [End]. the formulla went well with 

Networkdays([Start],[End],Holiday)

 

but in case [End] = null 

 

I've tried to replace null with today() [similar like excel] by writing 

Networkdays([Start],if [End] = null then DateTime.LocalNow else [End],Holiday)

 

Error show up as it seems wrong format. I've tried to put Date.From as well but it isn't work 

Networkdays([Start],if [End] = null then Date.From(DateTime.LocalNow) else [End],Holiday)

 

Your advice much be appreciated. Thank you so much in advance.

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @Bukhori ,

 

How about this:

if [End] = null then Networkdays([Start], Date.From(DateTime.LocalNow()), Holiday) else Networkdays([Start], [End], Holiday)

 

Let me know 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
tackytechtom
Super User
Super User

Hi @Bukhori ,

 

How about this:

if [End] = null then Networkdays([Start], Date.From(DateTime.LocalNow()), Holiday) else Networkdays([Start], [End], Holiday)

 

Let me know 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @tackytechtom ,

 

This is working fine!
Thank you so much for your assistance.

Helpful resources

Announcements
Join Arun Ulag at MPPC23

Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors
Top Kudoed Authors