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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
jcardea
Regular Visitor

Network days with decimals

Hello,

 

I'm new to power BI, and im trying to create a new calculated column that can calculate the number of working days with decimals between two dates. In excel would be something like this:

 

=(NETWORKDAYS(Start_date,End_Date,0)-1)+MOD(End_Date,1)-MOD(Start_Date,1)

 

i have my dates formatted like this 

 

Entered QueueModified On (Object) (Case)
4/6/18 10:214/11/18 11:00

 

I hope you can help me on this one, thanks!

1 ACCEPTED SOLUTION
ChandeepChhabra
Impactful Individual
Impactful Individual

@jcardea Hello

 

Please try the following calculated column

 

=COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR(datestable[Enter],datestable[Modified]),"Day",WEEKDAY ([Date],1)),[Day]<>1&& [Day]<>7))+INT(datestable[Enter])+1-datestable[Enter]+datestable[Modified]-INT(datestable[Modified])-2

 

Please replace

  1. datestable by the name of your own table
  2. Enter column by start date
  3. Modified column by end date

The formula considers Sat and Sun as weekends

 

View solution in original post

5 REPLIES 5
ChandeepChhabra
Impactful Individual
Impactful Individual

@jcardea Hello

 

Please try the following calculated column

 

=COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR(datestable[Enter],datestable[Modified]),"Day",WEEKDAY ([Date],1)),[Day]<>1&& [Day]<>7))+INT(datestable[Enter])+1-datestable[Enter]+datestable[Modified]-INT(datestable[Modified])-2

 

Please replace

  1. datestable by the name of your own table
  2. Enter column by start date
  3. Modified column by end date

The formula considers Sat and Sun as weekends

 

@ChandeepChhabra 

This function is awesome and works great for calculating turnaround times in my reports.

 

I'm tyring to generate another report where I would like turnaround time involved using this formual but I will also have cases where closed date has not yet been populated. Due to this I'm receiving an error. .

 

Is there any way to use this formula but filter for just for closed values? I have a column that identifies if a row has been closed or not. 

You are a legend!!! This works for me, thanks so much. Im trying to usnderstand the following part of the formula

........."Day"WEEKDAY ( [Date], 1 )

 

That is adding a number to this virtual table containing the day number so we can filter it out however where is "[date]" coming from and is it based on the first or 2nd date used int he formula?

 

Also is the formula basically working out whole days excluding weekends first, then adding in the fraction of a day?

Hi,

 

I trieded but there was an error saying "The start date in Calendar function can not be later than the end date." and I'm sure that none of the starting dates are later than the end dates...

 

thanks!

@jcardea Can you please share your data ? I'll see what's going wrong

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.