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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Madhavan
Frequent Visitor

How to Calculate Response and Resolution SLA of a ticket based on Ticket created date

Hi Experts,

 

My apologies if I am posting in wrong place.

I am having a requirement, where I have to calculate Target start date(Acknowledgement date/time for Response SLA) and Target Finish Date(Resolution Date/Time for Resolution SLA) based on the incidents (Ticket) created date. In my case I have only Reported Date(Created Date of Incident) and using that I have to calculate Response and Resolution Dates by excluding the Weekends and Non-Business Hours.

Can someone kindly help on this.

 

If I am posting this in the wrong forum, please guide me on where should I post this.

Thanks in advance.

 

Regards,

Madhavan

6 REPLIES 6
Madhavan
Frequent Visitor

Thanks Alex.

But I guess these will work if we have 2 dates like start and end dates.

In my case I am having only one date column, the created date of incident and I have to calculate Target start date(Acknowledgement date/time for Response SLA) and Target Finish Date(Resolution Date/Time for Resolution SLA) using the created date based on the priority of the ticket created.

Please let me know if any additional info required.

Anonymous
Not applicable

try this one Calculate Nth Business Day From Date in Power Query - BI Gorilla

 

Edit:

 

I tested this function specifically myself but it's copied directly from link above. Seems to do the job. You'd need to plug in your own holidays though.

let func =
( ReferenceDate as date, WorkdayOffset as number, optional Holidays as list) =>
let
/* Debug parameters
ReferenceDate = #date( 2021,1,1 ),
WorkdayOffset = 1,
Holidays = { #date( 2021,1,1 ) },
*/

// Returns empty list if Holidays are omitted
BufferedHolidays = List.Buffer( Holidays ?? {} ),

// Determines the positive or negative offset of Date.AddDays
AddDays = Number.Sign( WorkdayOffset ),

// Creates the List of Dates until it reaches the relevant Workday
ListOfDates =
List.Generate(
() => [
Date = Date.AddDays( ReferenceDate, AddDays ),
WD_Counter = 0,
IsWorkday = null
],
each if [WD_Counter] = Number.Abs( WorkdayOffset )
and [IsWorkday] = true then false else true,
each
let
NextDateIsWD = Date.DayOfWeek([Date], 1)
< 5 and not List.Contains( BufferedHolidays, [Date])
in
[
Date = Date.AddDays([Date], AddDays ),
WD_Counter = if NextDateIsWD then [WD_Counter] + 1
else [WD_Counter],
IsWorkday = NextDateIsWD
],
each [Date]
),

// Returns the relevant Workday, which is always last in the list
RelevantWorkday = List.Last( ListOfDates ),

// When 0 is used as Workdayoffset, the function returns the referencedate
Result = if WorkdayOffset = 0 then ReferenceDate else RelevantWorkday
in
Result,
documentation = [
Documentation.Name = " WORKDAY ",
Documentation.Description = " Function returns the date that lies an specfied number of business days from the reference date. ",
Documentation.LongDescription = " Function returns the date that lies an specfied number of business days from the reference date. The function takes into account weekends and can optionally respect a list of holiday dates. ",
Documentation.Category = " Nth Business Day ",
Documentation.Source = " https://gorilla.bihttps://gorilla.bi/power-query/nth-business-day-from-date/ ",
Documentation.Version = " 1.0 ",
Documentation.Author = " Rick de Groot",
Documentation.Examples = {[Description = " ",
Code = " let
ReferenceDate = #date( 2022, 9, 15 ),
WorkdayOffset = 2,
Holidays = { #date( 2022, 9, 19 ) },
Result = WORKDAY( ReferenceDate, WorkDayOffset, Holidays )

in
Result ",
Result = " #date(2022, 9, 20)
"]}]
in
Value.ReplaceType(func, Value.ReplaceMetadata(Value.Type(func), documentation))

Tried, but no luck, as we need to consider only business hours along with exclusion of weekends.

Anonymous
Not applicable

I don't see anything similar to borrow from online and not got the time at the moment to flesh it out more but I think if you have a calendar table with a flag for weekends and/or holidays then maybe this one is better solved in DAX given the time element. Rough sketch, I'd start with these variables: Day End, Day Start, Response Hours (time allowed for response) Resolution Time, Ticket Start Date, Ticket Start Time, Weekday Num Time Expired Today (if Weekday Num <> weekend) Time Remain (Start Time - Time Expired) Next Working Day (filter your date calendar using the flags) The last piece would be dividing those hours remaining into days and when that gets to less than a full day, you adjust the time on that last day.

I'm not sure on how to work out on this as I am new to Power BI and I have developed a basic report only. But I'll give it a try though. Thank you!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

August Carousel

Fabric Community Update - August 2024

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

Top Kudoed Authors