Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[birt-dev] Additional aggregation functions

Hi,

I am writing to get feedback on extending BIRT aggregation functions with few new functions: weighted average, weighted sum, compound sum. I am using birt to generate various risk reports, and i n found that those functions are essential for many templates. Having them as built-in, will simplify many templates, and will avoid the need to code them repeatedly.

Weighted-sum(v, w, threshold): calculate sum(w*v), ignoring any entry where w it v are null. The result is set to null:
* if any w is null
* if threshold is non-null, and the sum(w ) for entries with v=null / sum(w) > threshold.

The common usage will be to estimate total value of a portfolio, given set of holdings(w), and prices (v). The threshold logic make it possible to avoid showing result unless there is minimal data.

Weighted-average(v, w, threshold). Works the same, taking into account entries with non-null v. Entries with v = null will be excluded from the calculation. sum(v*w)/sum(w), fir all entries with v&w != null. Function return null if:
* any w is null
* sum(v*w) is null
* threshold not null, and sum(w) for v=null / sm(w) > threshold.
* sum(w) == 0

Compound-return(duration, return, threshold)  will calculate compound return base on period returns: product( (1+v) ^ duration ) for all entries with non null duration. Similar to the average/sum, result will be null if
* sum(duration) for non null v is 0
* all v are null
* threshold not null, and sum(duration) for non null v / sum(duration) > thread hold.

Average-return(duration, Return, threshold) - same as weighted average, calculate return per period compound-return(…) ^ (1/sum(duration) for return != 0)

Looking for a feedback.  Have enough knowledge to implement in Java.

Yair.




Back to the top