Is it possible to create a field that calculates based off the sums of two other fields (i.e., after aggregation)?
I have retail prices and discounted prices, and want to create a weighted average discount, which is the sum of all discounted prices over the sum of all retail prices. This is a fundamentally different # than taking the discount rate on a row by row basis and then averaging those numbers. I can figure out how to do the latter (unweighted) calculation in domain designer, and how to calculate something simple like dividing the sum of discounted prices by the total for the column in the adhoc view creator, but not to do a division of two fields post aggregation.
|ITEM ID||RETAIL||DSCNTED||DSCNT PCT|
.092 weighted (this row discount/retail)
Thanks, this is a good example of something we should be able to support in the product. We are implementing an expansion of the calculated fields capabilities in Ad Hoc for next release, and one thing I would like to enhance is the way we handle summary calculations. Currently, we just allow the user to specify a function, but for cases like this, the user should be allowed to have full control over how to calculate the summary.
A few releases back, we did make a change so that the sum of a calculated field "a/b" would be "sum(a)/sum(b)". The formula that you want for the summary is actually "1 - sum(discount)/sum(retail)".
I put your sample data into a database and tried it out. What I found was that the summary for "discount/retail" comes out as "sum(discount)/sum(retail)", but not summary for "1 - discount/retail" is really "sum(1 - discount/retail)", which is not correct.
Thanks again for bringing this up. Often we are trying to strike a balance between ease of use and power in designing the user interface. In cases like this, users have a good idea of what to do, and we should figure out how to get out of the way and let them do it!
I've got the same issue, i want to create a measure in domain designer which is SUM(fieldA)/SUM(fieldB) in aggregation view.
I don't find find the solution. I use Jasperserver pro 4.5. Is it possible or this feature is available only for next release ?
Thanks for your help.