Page 1 of 2

SumIf for All Data In DataSource

Posted: Mon Jul 13, 2015 9:01 am
by papinaser
Hi.
I need to have sum of a column in my datasource (my data table in stiReport) from some rows of data source that match with a criteria.
Stimul SumIf function do this but when I use this function in Group Band then this function do sum for rows that are in current group.
How can I have sum of a column from all rows in data band with a criteria in a group header/footer ?

Thanks

Re: SumIf for All Data In DataSource

Posted: Tue Jul 14, 2015 6:38 am
by HighAley
Hello.

You should use settings like on the image.
SumRunningTotal.png
SumRunningTotal.png (14.5 KiB) Viewed 7711 times
Thank you.

Re: SumIf for All Data In DataSource

Posted: Tue Jul 14, 2015 11:04 am
by papinaser
Hi. Thanks for your reply but it don't work for me.
You know I want sum from all rows In my data source with a criteria ,[in a group header/footer] NO sum from current group rows.

Re: SumIf for All Data In DataSource

Posted: Tue Jul 14, 2015 11:56 am
by HighAley
Hello.

To help you we need to see your report.
Please, send us your report template with sample data to support@stimulsoft.com.
Could you also attach screen-shot of the report with notes?

Thank you.

Re: SumIf for All Data In DataSource

Posted: Thu Jul 16, 2015 12:48 pm
by papinaser
HI.
You Now my question is very simple.
I have ProductSales view with this Fields :
ProductName
ProductPrice
SaleDate
SaleYear
SaleMonthName
In this view I have many rows for every day.

Now I grouped my view first by setting GroupHeader1 for SaleYear column and then by setting GroupHeader2 for SaleMonthName column and then by setting GroupHeader3 for SaleDate column.

In GroupHeader3 I have a textbox that I want to set it's value for average of sale (from all sale rows that SaleDate column of those is >= "1/1/SaleYear" and <= "current value in Groupheader3"

How can I do this?
Thanks.

Re: SumIf for All Data In DataSource

Posted: Fri Jul 17, 2015 7:45 am
by HighAley
Hello.

It's better to calculate such value with variable.
Set the value of the variable to zero at Before print event of the GroupHeader1 and add sale in Before Print event of the band.

Thank you.

Re: SumIf for All Data In DataSource

Posted: Fri Jul 17, 2015 9:16 am
by papinaser
Hi.
Thanks for your replay.
I test your solution in this way :
varSum1 = SumIf(ProductsDataSource.Sale,SaleDate >= "2015/1/1" && SaleDate<=CurrentSaleDateInGroupHeader3)
but this way like other ways return just Sum of records from current group not from all records in data source.

Re: SumIf for All Data In DataSource

Posted: Fri Jul 17, 2015 11:27 am
by HighAley
Hello.

To help you we need to see your report.
Please, send us your report template with sample data to support@stimulsoft.com.
Could you also attach screen-shot of the report with notes?

Thank you.

Re: SumIf for All Data In DataSource

Posted: Mon Jul 20, 2015 2:00 pm
by papinaser
Aleksey Andreyanov wrote:Hello.

It's better to calculate such value with variable.
Set the value of the variable to zero at Before print event of the GroupHeader1 and add sale in Before Print event of the band.

Thank you.
Hi. Thanks a lot for your replay.
I found a way for my problem with using variable and Events .
but I need Order of rise Events for my final solution.
Can you help me to find order of rising Events of group header and text boxes in it.
Thank you.

Re: SumIf for All Data In DataSource

Posted: Tue Jul 21, 2015 1:27 pm
by Andrew
Hello.

To help you we need to see your report.
Please, send your report template with sample data to support@stimulsoft.com.

Thank you.