Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Expression Builder - problems in JAVA scripting
BR12
Hello everyone,
I am using BIRT Report Designer 3.7.1 and I am facing problems in building an expression with JAVA script.
My data set includes the three columns "customer group", "expenses" and "orders". I would like to get the sum of "expenses" for each customer group (listed in the correspondent column "customer group"). Respectively, I need the sum of "orders" for each customer group.
What I have tried (and did not work out): if (customer group == 1) <sum> expenses
The final calculation should then be "expenses" divided by "orders" for each customer group as well.
Any help is highly appreciated!!
Thank you already in advance for taking the time,
BR12[/size]
Find more posts tagged with
Comments
johnw
Drop the data set into a table in the report designer. Create a group in the table for Customer Group. Then drop an aggregation component called expenseSum, set the level to Customer Group, and set to Sum the Expenses Column. Add a second aggregation called ordersSum to sum the Orders column with the same grouping. Then you can create just use the expression (expenseSum / ordersSum).
BR12
Thank you a lot for your fast reply and for explaining the necessary procedure that well to be understood!
BR12
Hello again,
maybe I was little too optimistic yesterday as I am facing now another problem when proceeding.
What I did not mention in my first post is how the table should finally look like:
I want the customer groups as column headings (for each group one column) and the expression "expensesSum/ordersSum" as row (the table could include as well the rows "expensesSum" and "ordersSum").
I therefore adjusted the grouping parameter to filter on "customer group = 1" only. The problem is that I cannot add another grouping parameter ("customer group = 2 "...) as I receive the failure notice "the expression's value cannot be retrieved. Group "customer group = 1" used in column "expensesSum" does not exist."
However when running the report, the figures are displayed correctly for customer group 1.
Therefore my questions: how should I first of all drop the expression "expensesSum/ordersSum"? I used the report item "data". Secondly, where should I drop the grouping parameter to enable several grouping parameters (one for each column)? I have tried the cross tab report item as well, but I don't know how to add the two aggregations and "expensesSum/ordersSum" as computed columns within the data set.
Thank you once more for any further advise!