Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula help Post Reply Post New Topic
Author Message
psalm19
Groupie
Groupie
Avatar

Joined: 19 Feb 2009
Online Status: Offline
Posts: 48
Quote psalm19 Replybullet Topic: Formula help
     Posted: 15 Nov 2013 at 11:51am
CR 10, SQL 2008 db
 
End result: show SLA percentage by a grouped field. Some example desired results:
 
Emergency = 50%
In Progress = 50%
 
Example report design:
Rep   -   SO   -   Status          -   WorkDate   -   SLADeadline
John  -   123  -   In Progress   -   11-1-13      -   10-30-13
Frank -   234  -   In Progress   -   11-9-13      -   11-12-13
Joe    -   456  -   Emergency    -   11-12-13    -   11-11-13
Sally  -   789  -   Emergency   -   11-10-13    -   11-10-13
 
If you compare workdate with sladeadline you'll notice 2 workdate's are past the sladeadline. If I add up each status, 2 for each status and then divide those that met the deadline by those that didn't we get 50% for each status.
 
I'm not sure where to begin with this type of calculation, suggestions please?
IP IP Logged
psalm19
Groupie
Groupie
Avatar

Joined: 19 Feb 2009
Online Status: Offline
Posts: 48
Quote psalm19 Replybullet Posted: 15 Nov 2013 at 12:06pm
Also need to figure out how to calculate empty workdate records with the date of run and compare it to the sladeadline and if's greater take a negative hit on the status percentage.
 
Continuing with the above example if this row was added and report was run on 11-14-13:
 
Joe  -  112   -   In Progress   -   <empty workdate>  -   11-13-13
 
Then In Progress status would be "33%" in meeting the the SLA
 
 
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 19 Nov 2013 at 8:39am
you could try
group on status
formula1
if WorkDate   <= SLADeadline then 1 else 0
formula 2
sum(formula1,Status)/count(SLADeadline,Status)
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 20 Nov 2013 at 5:03am
I haven't done this too often, but shouldn't we check if WorkDate is NULL as well...CR can be funny with nulls...so if kostya1122 solution is off a bit, you can try:
if isnull(workDate) then 0
else if workDate <=SLADeadline then 1 else 0

also, just to keep my head straight, shouldn't the inprogress be 40%, with emergency being 40% since both are 2/5 entries. I am not sure how to classify the one that is in progress but hasn't had work against it...I am assuming that it what the workDate refers to...

if that is correct, wouldn't that really be an Emergency as the workDate has to be > Deadline date if the report is run on the 14 for a deadline on the 13...

Just wondering
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum