Bug 215585 - Need a "Remainder" function
Summary: Need a "Remainder" function
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 2.2.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: Future   Edit
Assignee: Mingxia Wu CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2008-01-16 18:34 EST by Krishna Venkatraman CLA
Modified: 2010-03-30 01:39 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Krishna Venkatraman CLA 2008-01-16 18:34:25 EST
We have a Top N function. We need a function that aggregates the rest of the rows that do not fall into the top n.
Comment 1 Lin Zhu CLA 2008-01-17 11:36:25 EST
Hi,

Can you provide more details on your proposed function?

Thanks.
Lin
Comment 2 Krishna Venkatraman CLA 2008-01-17 13:11:56 EST
Consider a report that groups order $ sale amount information by customers.
Let us assume that there are 20 customers in the database.

In this table, lets say we limit the group to the top 5 spending customers. I.e in the group definition we define a filter that limits the # of customers listed to the top 5 customers by order $ sale amount.

When you view the report you get a list of the top 5 customers by $ of the order sale amount.

I also want to aggregate the orders $ sale amounts for all the remaining 15 customers into 1 "remainder" row. 

Perhaps I could insert another group header row below the first one that lists the top 5 customers. In this second group header row I could place an aggregation for the remaining customers $ sale amount. The exact details of the GUI would need to be decided but I hope I am conveying the usage scenario here.

So the final table output would look like:

1 Cust1 $100
2 Cust2 $90
3 Cust3 $80
4 Cust4 $70
5 Cust5 $60
Others  $120
Comment 3 Lin Zhu CLA 2008-05-22 23:40:06 EDT
This is not only a remainder function. It is a complete new style of grouping. Need to investigate.
Comment 4 Krishna Venkatraman CLA 2008-05-23 10:17:14 EDT
Lin,

This may not need to be that complicated. Can we add this functionality to the Filter dialog where you would apply the Top N filter?

In the example below, after grouping, I would need to use the table level filter to limit the results to just the top 5 customers. In this same dialog, we could look at adding the appropriate UI gestures to allow me to aggregate the remainder. Another suggestion is to take a look at the aggregation builder where we have various functions such as sum, count, is-top-n functions, etc. We could add a remainder function here that would work in conjunction with sum.
Comment 5 Lin Zhu CLA 2008-05-26 22:27:39 EDT
(In reply to comment #4)
> Lin,
> 
> This may not need to be that complicated. Can we add this functionality to the
> Filter dialog where you would apply the Top N filter?
> 
> In the example below, after grouping, I would need to use the table level
> filter to limit the results to just the top 5 customers. In this same dialog,
> we could look at adding the appropriate UI gestures to allow me to aggregate
> the remainder. Another suggestion is to take a look at the aggregation builder
> where we have various functions such as sum, count, is-top-n functions, etc. We
> could add a remainder function here that would work in conjunction with sum.
> 

Hi Krishna,

I do not think this can be apply as a filter. The filter is used to decide which rows should be appeared in final results, and only those rows can be aggregated.None do I think think this works in Aggregation builder for all the aggregations are against all the group instances rather than "some" of group instances(as "remainder")

The key problem to support your use scenario is that, in current grouping support in BIRT, we make groups depend on the data value of a row solely. However, what you requested is actually a "grouping" in which the groups are decided by not only the data values in a row, but also the context of it, that is, all the other rows in target Result Set. This is completely missing in BIRT, and the adding of it need extra efforts.

Thanks.
Lin