Page 1 of 1

Sum of Data Column in DataSource

Posted: Fri Apr 18, 2014 6:32 pm
by jamesmuir
I have a simple datasource (datasource1) that contains two columns. There are two records in this datasource that contain numeric values. My data looks like this

ID VALUE
0 2.5
1 3

I am trying to display the sum of the data in the VALUE field in a text component. My expression is this
{Sum(datasource1.VALUE)}

If i place the text component directly in the report, it only returns the first value in the output (2.5).

If i drop the text component into a databand, the correct value appears (5.5) but is repeated (because the databand renders the value for each record in the datasource). Is there a correct way to accomplish what I am trying to do? It seems like it would be a simple task but it is eluding me currently. Thank you.

Re: Sum of Data Column in DataSource

Posted: Mon Apr 21, 2014 8:41 am
by HighAley
Hello.

The Sum function can't work properly without Data Band.
Please, try to use next expression:

Code: Select all

{Sum(datasource1, datasource1.VALUE)}
Thank you.

Re: Sum of Data Column in DataSource

Posted: Mon Apr 21, 2014 12:46 pm
by jamesmuir
Thank you. I received an error when using the datasource name. I created an empty databand, placed the text component outside of the band, and referenced the databand as such.

{Sum(databand1, datasource1.VALUE)}

It now works. Thank you.

Re: Sum of Data Column in DataSource

Posted: Mon Apr 21, 2014 12:57 pm
by HighAley
Hello.

We are always glad to help you.
Let us know if you need any additional help.

Thank you.

Re: Sum of Data Column in DataSource

Posted: Thu Apr 21, 2022 1:04 pm
by dmasterplan
Mine didn't work. I did this:
I created a new calculated column and put this in expression: {Sum(DatadsPackages, dsAwardedContracts.Awarded)}
Need help.

Thanks

Re: Sum of Data Column in DataSource

Posted: Fri Apr 22, 2022 1:34 pm
by Lech Kulikowski
Hello,

Please send us a sample report with test data that reproduces the issue for analysis.

Thank you.

Re: Sum of Data Column in DataSource

Posted: Mon Apr 25, 2022 1:20 pm
by dmasterplan
Worked now. I just misspelled the variable I assigned it too. Thanks!

Re: Sum of Data Column in DataSource

Posted: Mon Apr 25, 2022 5:06 pm
by Max Shamanov
Hello,

You are welcome!