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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Urgent : SLA Time Difference b/w two dates except holidays

Dear Team,

i have start and end date need to get SLA between dates consider only working days  except public holidays dates.

SLA.JPG

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
Here is a sample file with the solution https://we.tl/t-YHm9uduPCj

1.png

Time Took (SLA) = 
VAR StartDate = Data[Start date]
VAR EndDate = Data[End Date]
VAR T1 = CALENDAR ( StartDate, EndDate )
VAR T2 = FILTER ( T1, NOT ( WEEKDAY ( [Date], 2 ) IN { 6, 7 } ) )
VAR NumberOfDays = COUNTROWS ( T2 ) 
VAR TimeDifference = TIMEVALUE ( EndDate - StartDate )
VAR NumberOfHours = HOUR ( TimeDifference )
VAR NumberOfMinutes = MINUTE ( TimeDifference )
VAR NumberOfSeconds = SECOND ( TimeDifference )
RETURN
    NumberOfDays & " Day(s) " & NumberOfHours & " H " & NumberOfMinutes & " M " & NumberOfSeconds & " S"

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks a lot its working fine as per mentioned DAX function
tamerj1
Super User
Super User

Hi @Anonymous 
Here is a sample file with the solution https://we.tl/t-YHm9uduPCj

1.png

Time Took (SLA) = 
VAR StartDate = Data[Start date]
VAR EndDate = Data[End Date]
VAR T1 = CALENDAR ( StartDate, EndDate )
VAR T2 = FILTER ( T1, NOT ( WEEKDAY ( [Date], 2 ) IN { 6, 7 } ) )
VAR NumberOfDays = COUNTROWS ( T2 ) 
VAR TimeDifference = TIMEVALUE ( EndDate - StartDate )
VAR NumberOfHours = HOUR ( TimeDifference )
VAR NumberOfMinutes = MINUTE ( TimeDifference )
VAR NumberOfSeconds = SECOND ( TimeDifference )
RETURN
    NumberOfDays & " Day(s) " & NumberOfHours & " H " & NumberOfMinutes & " M " & NumberOfSeconds & " S"
amitchandak
Super User
Super User

@Anonymous , refer if this business hour blog can help

https://exceleratorbi.com.au/calculating-business-hours-using-dax/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors