Using the Minstring() function to calculate the age of the oldest case in a queue

Support centers for any organization, log several customer cases during the day. These cases are sometimes tagged with a specific status such as contact, review, and so on. Each case goes through different statuses in the workflow until it reaches closed or sign off in the queue. The following example calculates the number of cases in each status of the workflow and then makes use of the Minstring() function to calculate the number of days passed since the oldest case logged for a particular status.

Getting ready

Load the following script which gives information on the cases logged at a debt collection agency:

LET vToday=num(today());
Case:
LOAD  CaseID ,DATE(Date#( DateLogged,'DD/MM/YYYY')) as DateLogged,
Status INLINE [
CaseID,DateLogged,Status
101,01/01/2002,Advice
101,25/04/2002,Contact
101,21/06/2003,Creditors Meeting
101,24/06/2003,Draft Allocation
101,30/06/2003,Sign off
102,18/10/2009,Contact
102,28/10/2009,Advice
102,11/02/2010,Creditors Meeting
102,20/03/2010,Draft Allocation
102,30/06/2010,Review
103,11/02/2013,New Business
103,19/06/2013,Draft Allocation
104,30/06/2010,New Business
105,30/06/2010,Contact
105,11/02/2013,New Business
106,19/06/2013,Drafting 
106,30/06/2010,Advice
];

How to do it…

  1. Drag the Table object onto the sheet from the Assets panel on the left. Name it Oldest case in Queue (in days).
  2. Add Status as the dimension.
  3. Next, add the following expression as the first measure and label it Case Volume:
    Count(CaseID)
  4. Add the following expression as the second measure and label it Oldest item in Queue (in Days):
    Num($(vToday)-(MinString({$<DateLogged=>} [DateLogged])),'#,##0')
  5. Under Sorting, promote Status to the top.
  6. Under Appearance, click on Presentation and uncheck Totals.
  7. Click on How to do it… when finished.
  8. The resulting table should look like the following screenshot. The figures you get for the Oldest Item in Queue table may be different, as the calculation is based on today's date, which will be different in your case:
    How to do it…

How it works…

Today's date is stored in a number format in the variable vToday(). The MinString() function finds the oldest value in the DateLogged field from the total number of cases for each status. Next, we take a difference between Today() and the minimum date for each status to get the number of days for the oldest case.

There's more…

By making use of the Peek() and Previous() functions and using the correct sort order during load, we can determine the case volume for each change of status. For example, count of cases that went from advice to contact, contact to creditors meeting, and so on.

See also

  • Using the RangeSum() function to plot cumulative figures in trendline charts
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset