Solved

Assign running totals based on two fields in a table

Posted on 2011-02-19
2
381 Views
Last Modified: 2012-05-11
I have a two tables Employees and Tickets.  An employee can either be the primary owner of a ticket, be a co-owner of ticket, or be both (owns the ticket entirely as both owner and co-owner or have a null co-owner).  If the employee owns the ticket in its entirety, then they get a full ticket count.  If they are either the primary or co-owner, then they are to only receive 1/2 credit.

How should I join my tables and graph the total ticket count for each employee?

EMPLOYEE TABLE
EMPID          NAME
1111            SallyJ
2222            JohnG
3333            DebraT

TICKET TABLE
TICKETID        OWNER        CO-OWNER
1                     1111             null
2                     1111             2222
3                      1111            1111
4                     2222             2222
5                     2222             1111
6                     2222             3333
7                     3333             3333

With the data above, this should be the result:
SallyJ (1111) - 3
JohnG (2222) - 2.5
DebraT(3333) - 1.5
0
Comment
Question by:c0fee
2 Comments
 
LVL 4

Expert Comment

by:msd1305
ID: 34935725
Easiest way would be to create 2 running total fields.
1) Calculate all full tickets (name: all_full_tickets)
Field to summarize: TICKETID
Type of summary: Distinct Count
Evaluate -> Use a formula -> isnull(CO-OWNER) or (OWNER = CO-OWNER)
Reset -. On Change of Group - > {TicketTable.Owner}

2) Calculate all half tickets (name: all_half_tickets)
Field to summarize: TICKETID
Type of summary: Distinct Count
Evaluate -> Use a formula -> (not isnull(CO-OWNER)) and (OWNER != CO-OWNER)
Reset -. On Change of Group - > {TicketTable.Owner}

3) Create a formula field "TotalTickets" with the formula    all_full_tickets + (all_half_tickets * 0.5 )
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 34935755
That will get the totals but since you used running totals, they can't be used in a graph.

To set this up you need to use a COMMAND as the data source
SQL similar to

SELECT EMPLOYEETABLE.EmpId, EMPLOYEETABLE.Name,
TICKETTABLE.TICKETID , TICKETTABLE.OWNER,  TICKETTABLE.COOWNER          
FROM EMPLOYEETABLE INNER JOIN TICKETTABLE
ON  EMPLOYEETABLE.EmpId = TICKETTABLE.OWNER        
UNION
SELECT EMPLOYEETABLE.EmpId, EMPLOYEETABLE.Name,
TICKETTABLE.TICKETID , TICKETTABLE.COOWNER,  TICKETTABLE.OWNER
FROM EMPLOYEETABLE INNER JOIN TICKETTABLE
ON  EMPLOYEETABLE.EmpId = TICKETTABLE.COOWNER  

In the report add a formula
If IsNull({TICKETTABLE.COOWNER)}) then
    1.0
Else
    0.5

You can then use the EmpId and this formula in the graph

mlmcc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now