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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
rocky09
Solution Sage
Solution Sage

Calculating TAT of working hours

How do I calculate TAT of only working hours. 

Lets say, my working hours are 9 AM to 6 PM and Weekends are Saturday and Sunday.

 

Below is a small example:

TicketTypeReceived_TimeCompletionDateStatusTurn Around Time
5545245Email Inbound09-02-2018 22:0512-02-2018 10:00Completed2.50
5485452Email Inbound08-02-2018 09:0508-02-2018 10:30Completed0.62

 

The Ticket 5545245 TAT is not correct as the email received after 6PM (Friday), Bascially, it should calculate TAT from Monday. So, the TAT should be 1 Hour.

 

Can someone help on this?

 

Thank you in advance,

1 ACCEPTED SOLUTION

Hey,

try something like this:

Column = DATEDIFF(
		if(
			WEEKDAY(Table1[Received_Time];2)>=5 && Table1[Received_Time]>timevalue("6:00:00 PM")
			;DATEADD(Table1[Received_Time].[Date]
			;8-WEEKDAY(Table1[Received_Time];2);DAY)
			+TIMEVALUE("09:00 AM")
		;Table1[Received_Time])
		;Table1[CompletionDate]
		;HOUR)

View solution in original post

5 REPLIES 5
WolfBiber
Microsoft Employee
Microsoft Employee

Hey,

what are you using to calculate TAT? Calc Column or M?

In Both you can use the if (-->DAX) function.

 

@WolfBiber

Hi, I am using DAX, difference between two dates. yes, but not able to get the TAT with Working Hours/Weekend logic.

Hey,

try something like this:

Column = DATEDIFF(
		if(
			WEEKDAY(Table1[Received_Time];2)>=5 && Table1[Received_Time]>timevalue("6:00:00 PM")
			;DATEADD(Table1[Received_Time].[Date]
			;8-WEEKDAY(Table1[Received_Time];2);DAY)
			+TIMEVALUE("09:00 AM")
		;Table1[Received_Time])
		;Table1[CompletionDate]
		;HOUR)

Hi

 

I tried this solutions its not giving the expected results. Can you tell me where I am going wrong.

 

My Business start date is 8:30 AM and Business End date is 18:00 PM

My TAT should calcuate only Business hours and excluding Weekends.

 

Business TAT = DATEDIFF(
IF(
'ADX Cases'[Created Business WeekDay]>=5 && 'ADX Cases'[Created Business CET Date]>TIMEVALUE("18:00:00"),
DATEADD('ADX Cases'[Created Business CET Date].[Date],8-'ADX Cases'[Created Business WeekDay],DAY)+TIMEVALUE("08:30:00"),
'ADX Cases'[Created Business CET Date]),
'ADX Cases'[FirstTouched Business CET Date],HOUR)

 

Created Business CET DateCreated Business CET WeekDayCase IDFirstTouched Business CET DateFirstTouched CET WeekDayBusiness TATExpected Business TAT
11/29/2019 8:305112/2/2019 12:301413.5
11/29/2019 11:375212/2/2019 15:181713.75
11/29/2019 12:455312/2/2019 16:201813.65
11/29/2019 13:095412/3/2019 13:0822918.97
11/29/2019 14:085512/2/2019 9:49115.27
12/6/2019 8:305612/6/2019 9:355-711.05
12/6/2019 8:305712/9/2019 8:49109.49
12/6/2019 8:305812/6/2019 8:405-72                                           0.20

 

Regards,

Charles Thangaraj

Thank you so much @WolfBiber

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.