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

How to sum group-footer values?

6 Answers 1363 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 06 Aug 2019, 09:18 AM

Hello,

I have a report to show vehicle datas.

For each group here the vehicle, e.g. PCH W 100,  I calculate the difference with the formula

= (MAX(Fields.Mileage) - MIN(Fields.Mileage)) + " km"

(See black arrows in the attached screenshot!)

The result should be summed up and displayed in the bottom line.

But I have no idea how to make it.

This throw an exeption:

= Sum((MAX(Fields.Mileage) - MIN(Fields.Mileage)))

 

Best Regards.

 

 

 

 

6 Answers, 1 is accepted

Sort by
0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 08 Aug 2019, 04:52 PM

Hi Simon,

This appears to be the SUM in the total formula. Since the data is grouped on the Fahrzeug row it creates a group Scope within the Crosstab and the calculations values would use the same formula.

This means that the group total value isn't grouped and would calculate the value containing the whole data set.  In contrast, the subtotal group calculates the value over each group.

For the total, the formula would be like the following.

[= MAX(Fields.Mileage) - MIN(Fields.Mileage)]

Alternatively, this could be quickly achieved using the Crosstab Wizard. Let me provide a visual guide below.

Step 1: Select the data source.

Step 2: Arrange the Fields

Step 3: Select the Subtotal/Total Layout

For reference, I have also attached a sample report.

Please let me know if you need any additional information. Thank you.

Regards,

Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Simon
Top achievements
Rank 1
answered on 09 Aug 2019, 09:07 AM

 Hello Eric R,

please see the attached screenshot.

The Subtotals are correct calculated, the difference between maxvalue and minvalue, but the total not.

The total should be the sum of all Subtotals and the result must be 11636.

In my case, how I try to demonstrate in the above screenshot Vehicle-Report.jpg, I want to sum up all the values in the groupfooter lines.

So the result would be 17104.

Is there an easy way to sum up all the groupfooter-values (or whatever you call it:Subtotals) ?

Best Regard

 

Simon

 

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 12 Aug 2019, 03:02 PM
Hi Simon,

In this case, the User Aggregate Functions will achieve the desired result. I have attached a sample that accomplishes this and will provide a brief explanation with resources below. Note that the sample is provided in the Visual Studio Report Designer and can also be accomplished by Extending the Stand Alone Report Designer

Explanation
User aggregate functions allow the use of custom logic in aggregates. After implementing the custom logic, the value is either calculated as a SUM or a DIFFERENCE based on the rowKind which is passed into the function as SUBTOTAL or TOTAL. Below is the formula in the Subtotal and Total value properties.

Subtotal:

= 'Subtotal: ' + CalcDifference(Fields.Source, Fields.Mileage, 'SUBTOTAL')

Total:

=CalcDifference(Fields.Source, Fields.Mileage, 'TOTAL')

Report Preview:


Resources
Implementing Custom Aggregates KB Article
Calculations Based on Another Field KB Article


Please let me know if you need any additional information. Thank you for using Telerik Reporting.

Regards,

Eric R | Technical Support Engineer
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Simon
Top achievements
Rank 1
answered on 13 Aug 2019, 02:53 PM

 

Thank you very much.

But I have an error message when I try to run your given project.

Best regards

Simon

 

 

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 13 Aug 2019, 04:31 PM
Hi Simon,

This will require Configuring the Telerik Nuget Feed for Visual Studio. Once this is configured the NuGet packages will restore properly.

Please let me know if you need any additional information. Thank you.

Regards,

Eric R | Technical Support Engineer
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Simon
Top achievements
Rank 1
answered on 14 Aug 2019, 12:10 PM

Hello,

I still have this error message, but it doesn't matter anymore.

  --> Package Telerik.Reporting "13.1.19.618" do not found at source https://nuget.telerik.com/nuget

Because I have acces to your source code and MileageReport.cs .

I have copied this and it works fine.

That helps me a lot, thank you!

Although it seems a little complicated.

Best Regards

 

Simon

 

 

Tags
General Discussions
Asked by
Simon
Top achievements
Rank 1
Answers by
Eric R | Senior Technical Support Engineer
Telerik team
Simon
Top achievements
Rank 1
Share this question
or