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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Applicable88
Impactful Individual
Impactful Individual

Count the networkdays between to Dates only when its a ProductiveDay.

Hello, 

I have a factable and a Mastercalendar as a dimensiontable. In the Bookingtable I want to know the processingtime of

two Dates without the weekends and the non-productive Days. With Bookingdate - IncomeDate I would only get the "WrongProcessingTime" but I need the "CorrectProcessingTime". 

In the Mastertable I have all the information, but I don't know how to combine these. The "ProductiveDay" column tells me if its 

a working day or not. 1 is a ProductiveDay.  A Zero tells me its weekend or public holiday.

I'm thinking of a calculated column like Datediff( IncomeDate, BookingDate, Day) , but I don't know how to include the ProductiveDays into that function.

 

BookingTable

 

IncomeDate BookingDate IDWrongProcessingTime CorrectProcessingTime
2021-09-01 2021-09-01 88880  0 
2021-09-02 2021-09-03 88891  1 
2021-09-03 2021-09-06 88903  1 
2021-09-06 2021-09-07 88911  1 
2021-09-07 2021-09-07 88920  0 
2021-09-08 2021-09-08 88930  0 
2021-09-09 2021-09-14 88945  3 
2021-09-10 2021-09-13 88953  1

 

 

 

Mastercalendar:

 

DateWeekdayProductiveDay
2021-09-01Wednesday1
2021-09-02Thursday1
2021-09-03Friday1
2021-09-04Saturday0
2021-09-05Sunday0
2021-09-06Monday1
2021-09-07Tuesday1
2021-09-08Wednesday1
2021-09-09Thursday1
2021-09-10Friday1
2021-09-11Saturday0
2021-09-12Sunday0

 

I really appreciate your help. 

Thank you very much in advance.

Best. 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

3 REPLIES 3
Fowmy
Super User
Super User

amitchandak
Super User
Super User

@Applicable88 , You can try a new column like

 

business Day = COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR(Table[IncomeDate],Table[Booking Date]),"WorkDay", if(WEEKDAY([Date],2) <6,1,0)),[WorkDay] =1))

 

How to calculate Business Days/ Workdays, with or without date table: https://youtu.be/Qv4wT8_P-AA

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

HI @amitchandak,

the calendar part is giving me an error: the startdate of the calendar function cannot be after the enddate...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.