Total.sum for negative and positive value

lpurba
edited February 11, 2022 in Analytics #1
Hi all,<br />
I am having an issue with Total.sum() function. I created a report similar to <a class='bbc_url' href='http://www.eclipse.org/birt/phoenix/examples/solution/crosstab.html'>http://www.eclipse.org/birt/phoenix/examples/solution/crosstab.html</a>.<br />
<br />
The different is, my data has positive and negative values. So, I have this:<br />
<structure><br />
<property name="name">BQ</property><br />
<expression name="expression">Total.sum(dataSetRow["account_balance"])</expression><br />
<property name="dataType">integer</property><br />
<property name="aggregateOn">Quarter</property><br />
</structure><br />
<br />
But the result for this expression is not adding up all the positive and negative values.<br />
<br />
Did anyone have experience this before?<br />
<br />
Any help is appreciated.<br />
<br />
Thanks!<br />
-Laurent

Comments

  • lpurba
    edited December 31, 1969 #2
    Following my previous thread, I found something interesting.

    I have 1040 records as the result of the query, and I assigned it to data set, let say payment_amount. So, when I displayed that payment_amount, and I clicked "Preview" tab, it does not show 1040 records, and the SUM of that I get by using Total.sum(dataSetRow["payment_amount"]) is not the same with the SUM from SQL command (I am using PostgreSQL).

    Is the preview tab displaying all the records from the query or data set?

    Thanks!
    -Laurent
  • lpurba
    edited December 31, 1969 #3
    One more thing, the SUM works if I preview it birt viewer, but not in eclipse.

    Thanks!
    -Laurent
  • rmurphy
    edited December 31, 1969 #4
    Laurent,<br />
    The default setting for the the number of records to use in the preview window is 500. This setting can be changed in Windows -> Preferences... select Report Design -> Preview. Maximum number of rows to display is set by default to 500. This allows you to make incremental design changes without having to completely build the report. If you want to view the report with all the data, use the options under View Report.<br />
    <br />
    By the way, Total.sum() is deprecated. You should look at the Aggregation builder. You can read more about Total.sum() deprecation here: <a class='bbc_url' href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=196738'>https://bugs.eclipse.org/bugs/show_bug.cgi?id=196738</a&gt;
  • lpurba
    edited December 31, 1969 #5
    Thanks for your help, Rob.
    -Laurent