SumIf for All Data In DataSource

Stimulsoft Ultimate discussion
papinaser
Posts: 9
Joined: Mon Jul 13, 2015 7:43 am

SumIf for All Data In DataSource

Post 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
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: SumIf for All Data In DataSource

Post by HighAley »

Hello.

You should use settings like on the image.
SumRunningTotal.png
SumRunningTotal.png (14.5 KiB) Viewed 7710 times
Thank you.
papinaser
Posts: 9
Joined: Mon Jul 13, 2015 7:43 am

Re: SumIf for All Data In DataSource

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: SumIf for All Data In DataSource

Post 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.
papinaser
Posts: 9
Joined: Mon Jul 13, 2015 7:43 am

Re: SumIf for All Data In DataSource

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: SumIf for All Data In DataSource

Post 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.
papinaser
Posts: 9
Joined: Mon Jul 13, 2015 7:43 am

Re: SumIf for All Data In DataSource

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: SumIf for All Data In DataSource

Post 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.
papinaser
Posts: 9
Joined: Mon Jul 13, 2015 7:43 am

Re: SumIf for All Data In DataSource

Post 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.
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

Re: SumIf for All Data In DataSource

Post 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.
Post Reply