Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...The level of expertise is awesome. The nature in which people respond is professional helpful and not the least condescending. I can't say that for most forums..."

Geography

Where in the world do Tek-Tips members come from?
morles (IS/IT--Management)
17 Jul 12 7:37
I trying to create a report that will calculate the total value an engineer generates from his customer service cases.

I have four fields in my report:
Case No: Unique ID for each Customer service case
Case Fee: Value of case (currency)
Engineer1: Engineer Name
Engineer2: Engineer Name

The problem I am having is that some customer services cases are dealt by one engineer and some are dealt by two engineers. So an engineer’s name could be input in either field. I would like to find a total that each engineer generates whether their name is input in either field. Essentially what I am trying to do is create the group summaries by engineer with the total case value beside the engineer’s name. If possible I would like it to be in Basic or Crystal Syntax and not SQL (as I only have basic knowledge of it). I’m not sure if this is even possible.Any help would be really appreciated.
IanWaterman (Programmer)
17 Jul 12 8:44
YOu will have to use a command or view to union the data, this requires you to write some SQL on the following lines

select CaseNo, CaseFee, Engineer1, 'Eng1' as Engineer
From yourtable
where Engineer1 is not null
union all
select CaseNo, CaseFee, Engineer2, 'Eng2' as Engineer
From yourtable
where Engineer2 is not null

I have added the dummy colum Engineer so that you know which filed the data came from. Might be useful if not don't bother.

Ian
morles (IS/IT--Management)
17 Jul 12 12:08
Thanks so much that worked really well! The only issue now is that I need a formula to work out how much each engineer will generate. So now there are duplicates in the CaseNo field (which is fine as this only happens when there is more than one engineer dealing with the case), however if there is two engineers on a case then the the case fee is to be divided by two. So essentially if there is one engineer on the case then the case fee is X and if there are two engineers on the case then the case fee is X/2. Once I have this formula correct I can group the Engineer field by Engineer Name and perform an Autosum.
IanWaterman (Programmer)
18 Jul 12 5:17
Add an extra colun to query

select CaseNo, CaseFee, Engineer1, 'Eng1' as Engineer,
case when Engineer2 is not null 'Y' else 'N' end as 2nd_Eng
From yourtable
where Engineer1 is not null
union all
select CaseNo, CaseFee, Engineer2, 'Eng2' as Engineer,
case when Engineer1 is not null 'Y' else 'N' end as 2nd_Eng
From yourtable
where Engineer2 is not null

Ian
morles (IS/IT--Management)
20 Jul 12 6:42
Thanks so much. That worked perfectly!

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close