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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
asah
Helper I
Helper I

Help needed with Recursive / Iterative Calculation

Hi,

I am requesting for some help in achieving the following outcome in Power BI which requires a recursive calculation. The source data has the following columns:

 

Date Ticket Created - The date when the ticket was created

Date Ticket Solved - The date when the ticket was set to a solved state

Ticket ID - Unique ID of the ticket

Ticket Priority - Priority assigned to the ticket

Ticket Status - New / Open / Solved / Closed

SLA Status - Achieved / Active / Breached (Fulfilled) / Breached (Active)

Ticket Type - Incident / Problem / Task / Question

WeekTicketCreate - Week Number generated from a custom lookup table referencing the date when the ticket was created

WeekTicket Solve - Week Number generated from a custom lookup table referencing the date when the ticket was solved

Open@EOW (End of Week) - Custom column comparing if WeekTicketSolve > WeekTicketCreate and assign a 1 or 0 accordingly

IsSLABreach - Custom Column to assign True if SLA Status is Breached (Fulfilled) or Breached (Active) and False if Achieved

IsOpen - Custom Column to assign True  if Ticket Status is New or Open and False if Solved or Closed

Since the source data contains historical information as well, tickets in the past may well be reflecting in a solved / closed status but I am keen to see at a given day, how many tickets raised previously or on the same day were open and out of SLA.

 

Requirement - For each date in the table, I am looking at generating a cumulative count of open tickets (Incident & Problems) where IsSLABreach = True for the previous or same dates.

 

Date (Ticket Created)Date (Ticket Solved)Ticket IdTicket PriorityTicket StatusSLA Metric StatusTicket TypeWeekTicketCreateWeekTicketSolveOpen@EOWPeriodYearIsSLABreachIsOpen
30-Jan-2003-Feb-2011115088P3SolvedBreached (Fulfilled)Incident49501P122019-20TRUEFALSE
04-Feb-20 11115089P3OpenActiveIncident50 0P122019-20FALSETRUE
04-Feb-20 11115090P3OpenActiveIncident50 0P122019-20FALSETRUE
29-Jan-2030-Jan-2011115091P4SolvedBreached (Fulfilled)Incident49490P122019-20TRUEFALSE
30-Jan-2003-Feb-2011115092P4SolvedBreached (Fulfilled)Incident49501P122019-20TRUEFALSE
30-Jan-2003-Feb-2011115093P4SolvedBreached (Fulfilled)Incident49501P122019-20TRUEFALSE
31-Jan-2003-Feb-2011115094P4SolvedBreached (Fulfilled)Incident49501P122019-20TRUEFALSE
31-Jan-2031-Jan-2011115095P4SolvedAchievedIncident49490P122019-20FALSEFALSE
31-Jan-2003-Feb-2011115096P4SolvedBreached (Fulfilled)Incident49501P122019-20TRUEFALSE
31-Jan-2004-Feb-2011115097P4SolvedBreached (Fulfilled)Incident49501P122019-20TRUEFALSE
01-Feb-2005-Feb-2011115098P4SolvedBreached (Fulfilled)Incident49501P122019-20TRUEFALSE
02-Feb-20 11115099P4OpenBreached (Active)Incident49 1P122019-20TRUETRUE
02-Feb-2004-Feb-2011115100P4SolvedBreached (Fulfilled)Incident49501P122019-20TRUEFALSE
02-Feb-2004-Feb-2011115101P4SolvedBreached (Fulfilled)Incident49501P122019-20TRUEFALSE
03-Feb-2004-Feb-2011115102P4SolvedAchievedIncident50500P122019-20FALSEFALSE
03-Feb-2004-Feb-2011115103P4SolvedBreached (Fulfilled)Incident50500P122019-20TRUEFALSE
04-Feb-2005-Feb-2011115104P4SolvedBreached (Fulfilled)Incident50500P122019-20TRUEFALSE
04-Feb-2005-Feb-2011115105P4SolvedBreached (Fulfilled)Incident50500P122019-20TRUEFALSE
04-Feb-20 11115106P4NewActiveIncident50 0P122019-20FALSETRUE
04-Feb-2004-Feb-2011115107P2SolvedAchievedIncident50500P122019-20FALSEFALSE
04-Feb-2005-Feb-2011115108P3SolvedBreached (Fulfilled)Task50500P122019-20TRUEFALSE
04-Feb-2004-Feb-2011115109P3SolvedAchievedTask50500P122019-20FALSEFALSE
04-Feb-2004-Feb-2011115110P3SolvedAchievedTask50500P122019-20FALSEFALSE
04-Feb-2004-Feb-2011115111P3SolvedAchievedTask50500P122019-20FALSEFALSE
04-Feb-2004-Feb-2011115112P3SolvedAchievedTask50500P122019-20FALSEFALSE
04-Feb-2004-Feb-2011115113P3SolvedAchievedTask50500P122019-20FALSEFALSE
04-Feb-2005-Feb-2011115114P3SolvedAchievedTask50500P122019-20FALSEFALSE
03-Feb-20 11115115P3OpenBreached (Active)Incident50 1P122019-20TRUETRUE
1 ACCEPTED SOLUTION

Apologies for the delayed response, I have found the solution to my query here:

https://community.powerbi.com/t5/Desktop/Cumulative-backlog-to-date/td-p/35469

 

Thanks for your time and I really appreciate you looking into this for me.

View solution in original post

9 REPLIES 9
tkirilov
Resolver I
Resolver I

Hi @asah ,

 

Perhaps the following measure: 

OpenTicketCount = Calculate(Distinctcount([Ticket Id]), [IsBreached] = "True")

 

And if you slice that by date in a table visual for example, it should give you the desired result. That's if I've fully understood your requirement of course.

Hi @asah  

not sure about your requirement here. With regards to the first row: Do you want to count this item as open at the date of 31. January of example? So basically create a history of open/closed status?

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi @ImkeF 

Thanks for looking into this. Apologies, I noticed that I did not sort the sample data before uploading. It should be sorted first on the created date and then the ticket id. Regardless of that, this is what I am trying to achieve in a column:

1) Considering that ticket created on 30-Jan is the first ticket in the source data, the backlog of open tickets out of SLA will be 0

2) 2nd row suggests that a ticket has been created on 4-Feb, however the previous ticket has been closed on 3-Feb, so the backlog of open tickets out of SLA remain 0.

3) Again, there is another ticket opened on 4-Feb and the previous ticket still remains open and IsSLABreach = False, so the backlog still remains 0. However, if the IsSLABreach had been True, the value would have been 1.

So on and so forth. Please let me know if I am making sense or I will try and explain differently. Any help is greatly appreciated.

Cheers,

Anirudh

Hi @asah ,

so you're looking for a column on the existing table or a measure in your model?

Am I assuming correctly, that all this has to be applied on Ticket-ID-Level (as row 4 starts again with 29th Jan..)?

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi Imke,

I am hoping to produce a column as I'd like to display the values as a part of a matrix with other columns. The ticket IDs are incremental in nature so ideally should be by date created and then the ticket id's as multiple tickets can be created on the same day. My sample data was not sorted so may be causing the confusion.

Thanks @asah  for clarification.

Could you please provide new correct sample data and also display the desired result?

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi Imke,

Please see the below sample data:

Date (Ticket Created)Date (Ticket Solved)Ticket IdTicket PriorityTicket StatusSLA Metric StatusTicket TypeWeekTicketCreateWeekTicketSolvePeriodYearIsSLABreachBacklog out of SLAComments
29-Jan-2030-Jan-2011111111P4SolvedBreached (Fulfilled)Incident4949P122019-20TRUE1#11111111
30-Jan-2003-Feb-2011111112P3SolvedBreached (Fulfilled)Incident4950P122019-20TRUE1#11111112
30-Jan-2003-Feb-2011111113P4SolvedBreached (Fulfilled)Incident4950P122019-20TRUE2#11111112, #11111113
30-Jan-2003-Feb-2011111114P4SolvedBreached (Fulfilled)Incident4950P122019-20TRUE3#11111112, #11111113, #11111114
31-Jan-2003-Feb-2011111115P4SolvedBreached (Fulfilled)Incident4950P122019-20TRUE4#11111112, #11111113, #11111114, #11111115
31-Jan-2031-Jan-2011111116P4SolvedAchievedIncident4949P122019-20FALSE4#11111112, #11111113, #11111114, #11111115
31-Jan-2003-Feb-2011111117P4SolvedBreached (Fulfilled)Incident4950P122019-20TRUE5#11111112, #11111113, #11111114, #11111115, #11111117
31-Jan-2004-Feb-2011111118P4SolvedBreached (Fulfilled)Incident4950P122019-20TRUE6#11111112, #11111113, #11111114, #11111115, #11111117, #11111118
01-Feb-2005-Feb-2011111119P4SolvedBreached (Fulfilled)Incident4950P122019-20TRUE7#11111112, #11111113, #11111114, #11111115, #11111117, #11111118, #11111119
02-Feb-20 11111120P4OpenBreached (Active)Incident49 P122019-20TRUE8#11111112, #11111113, #11111114, #11111115, #11111117, #11111118, #11111119, #11111120
02-Feb-2004-Feb-2011111121P4SolvedBreached (Fulfilled)Incident4950P122019-20TRUE9#11111112, #11111113, #11111114, #11111115, #11111117, #11111118, #11111119, #11111120, #11111121
02-Feb-2004-Feb-2011111122P4SolvedBreached (Fulfilled)Incident4950P122019-20TRUE10#11111112, #11111113, #11111114, #11111115, #11111117, #11111118, #11111119, #11111120, #11111121, ##11111122
03-Feb-2004-Feb-2011111123P4SolvedAchievedIncident5050P122019-20FALSE5#11111118, #11111119, #11111120, #11111121, ##11111122
03-Feb-2004-Feb-2011111124P4SolvedBreached (Fulfilled)Incident5050P122019-20TRUE6#11111118, #11111119, #11111120, #11111121, #11111122, #11111124
03-Feb-20 11111125P3OpenBreached (Active)Incident50 P122019-20TRUE7#11111118, #11111119, #11111120, #11111121, #11111122, #11111124, #11111125
04-Feb-20 11111126P3OpenActiveIncident50 P122019-20FALSE3#11111119, #11111120, #11111125
04-Feb-20 11111127P3OpenActiveIncident50 P122019-20FALSE3#11111119, #11111120, #11111125
04-Feb-2005-Feb-2011111128P4SolvedBreached (Fulfilled)Incident5050P122019-20TRUE4#11111119, #11111120, #11111125, #11111128
04-Feb-2005-Feb-2011111129P4SolvedBreached (Fulfilled)Incident5050P122019-20TRUE5#11111119, #11111120, #11111125, #11111128, #11111129
04-Feb-20 11111130P4NewActiveIncident50 P122019-20FALSE5#11111119, #11111120, #11111125, #11111128, #11111129
04-Feb-2004-Feb-2011111131P2SolvedAchievedIncident5050P122019-20FALSE5#11111119, #11111120, #11111125, #11111128, #11111129
04-Feb-2005-Feb-2011111132P3SolvedBreached (Fulfilled)Task5050P122019-20TRUE  
04-Feb-2004-Feb-2011111133P3SolvedAchievedTask5050P122019-20FALSE  
04-Feb-2004-Feb-2011111134P3SolvedAchievedTask5050P122019-20FALSE  
04-Feb-2004-Feb-2011111135P3SolvedAchievedTask5050P122019-20FALSE  
04-Feb-2004-Feb-2011111136P3SolvedAchievedTask5050P122019-20FALSE  
04-Feb-2004-Feb-2011111137P3SolvedAchievedTask5050P122019-20FALSE  
04-Feb-2005-Feb-2011111138P3SolvedAchievedTask5050P122019-20FALSE  

 

I have manually calculated the backlog of open tickets where IsSLABreach = True for each day based on the preceeding dates and have mentioned the ticket nos. to support the count. What I am looking for is a dynamic count as the one mentioned in the example, fetch only the last value for each date as that will be accurate and the ability to customize the formula based on ticket type and ticket priority.

Thank you @asah 

could you please upload a sample of the desired result as well? Thx.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Apologies for the delayed response, I have found the solution to my query here:

https://community.powerbi.com/t5/Desktop/Cumulative-backlog-to-date/td-p/35469

 

Thanks for your time and I really appreciate you looking into this for me.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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