This is a migrated thread and some comments may be shown as answers.

Aggregating a column of First's not Sums

3 Answers 210 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 30 Mar 2020, 08:24 AM

Hi

I'm new to telerik and I'm trying to figure out how best to approach this problem.

 

I have a datasource that contains rows for individual ice cream sales for people by date. So a person could have multiple rows under different date (e.g. John could buy chocolate ice cream on 02/02/2020 and vanilla on 02/03/2020).

 

I have a column that stores the total number of ice creams a person has bought in history, my report shows the total number of ice creams a persons bought between two dates and the total in history like so:

 

Name | Total Ice Creams Bought | Ice Creams For Date |

John   |                  5                     |              2                    |

Max    |                 10                    |              5                    |

 

So in the data returned there's 2 rows for "John" and 5 rows for "Max". Now in the report the "Total Ice Creams Bought" is the First of that column while "Ice Creams For Date" is a Sum.

 

I want to add another column that will have the sum of these rows in the report,however because the "Total Ice Creams Bought" is aggregated in the datasource (it's 5 for "John" in every row) when I sum it it will sum it for every row.

 

So in the above example the aggregate row after I created it returns 60 instead of 15 (10 for "John's" two 5's and 50 for "Max's" five 10s), is there a way to aggregate just the values as they're shown in the report instead of the aggregate values of the datasource?

 

Cheers!

3 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 30 Mar 2020, 09:35 AM
Sorry I meant I want to add another row to aggregate these values not another column!
0
Katia
Telerik team
answered on 02 Apr 2020, 06:25 AM

Hi Richard,

I am not sure what report items are used to display the data and how the groupings and filtering are configured exactly. You can test using RunningValue(scope, aggregateFunction) built-in function to calculate the total for the Total Ice Creams Bought column. The value for this function resets to 0 for each new instance of the specified parent scope. If a group is specified, the running value is reset when the group expression changes. If a data item is specified, the running value is reset for each new instance of the data item.

In case you need further help, send us the report definition in a support ticket so we can investigate the exact settings of the report and provide you further suggestions.

 

Regards,
Katia
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Richard
Top achievements
Rank 1
answered on 08 Apr 2020, 11:42 AM

Thanks Katia, it turns out I no longer have to achieve this functionality but I will try to remember this post if the issue comes up again.

 

Cheers

Tags
Report Designer (standalone)
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Katia
Telerik team
Share this question
or