Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to avoid duplications making a SUM calculated field

569536May 11 2009 — edited May 12 2009

Hi, I'm trying to resolve this problem;
In my dataset (in a custom folder on the administrator) I have a list of tickets (with some attributes), and some of them are duplicated:

For example

Ticket_id     Group_id             Ticket_date                Resource_name          Ticket_status       

5416          100000401       10/12/2007 7:10:31 am                Mr. A                 2
5416          100000401       9/1/2008 11:00:44 pm                 Mr. A                 2
57381         100000401       27/12/2007 11:37:11 am               Mr. A                 2 
57381         100000401       15/1/2008 9:33:12 am                 Mr. A                 2

I want this duplication because I need it when I filter the dataset (using the Ticket_date) with two parameters:

Ticket_date between lower_limit_date and upper_limit_date

So, inside the report, regarding the ticket's number, if I take 2 records with the same ticket_id, I have a calculated field where I use the COUNT_DISTINCT and for each couple of tickets the count is always =1; in this way (inside the report) I have the following fields:

Group_id           Count_tickects   Resource_name   

100000401              2                    Mr. A                 

This is OK !

Now, if I want to count how many tickets have the status = 2 (it means they are closed), I want to obtain 2 and NOT 4

I tried to use this calculation (Tickets Closed): SUM(CASE WHEN "Tickets Report #7 COMPL".Ticket Status Id = 2 THEN 1 ELSE 0 END)
but I always had the result of 4...and this not correct, because the tickets are only 2...
I also tried to use some analytic function using the OVER PARTITION BY, but I didn't obtain the correct result

In other words I'd like to achieve this:

Group_id           Count_tickects   Tickets Closed     Resource_name

100000401              2                     2             Mr.A

Any help will be appreciated

Alex

This post has been answered by Rod West on May 12 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 9 2009
Added on May 11 2009
4 comments
920 views