Need help in writing a Crystal reports formula


I have a data printing as shown below.  My report is grouped by Ticket Number.  I have shown the details section of one ticket no.

Ticket No         Type                   Duration Time
 IM44-00256    Initial                    0.00
 IM44-00256    Upgrade              0.00
 IM44-00256    Downgrade         5.25
 IM44-00256   Downgrade         6.62
 IM44-00256  Upgrade              2.00
  IM44-00256   Resolved            3.35

What I need to write is a formula that just SUM the Duration time of 2nd Downgrade = 6.62 and the Resolved = 3.35.

 The concept behind this is, if there's an Type = upgrade and the previous type = "Downgrade" then get the Duration Time and add to DurationTime of type = "Resolved" and show it in the group footer of each ticket number. If there's no "Upgrade" after a Type "Downgrade" then just show the DurationTime of Type = "Resolved"

Please assist .

Thank you

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this :

1.write a formula and place it Group Header and suppress

numbervar num ;

2. write a formula and place it Details and suppress

numbervar num ;
if {Type} = "upgrade" and the previous ({type}) = "Downgrade" then
num := num + {Duration Time}
else if {Type} = "Resolved " then
num := num + {Duration Time}

3. write a formula and place it Group Footer and show
numbervar num ;

======if your time is not number ,then change "numbervar" to "
timevar" in all of above formulas========


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
angel7170Author Commented:
Perfect! This works awesome!

I just have a slight modification because if Type = "Resolved" it should be as

num := {Duration Time}

Thank you very much
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.