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

After I aggregate some columns, I want to show a percentage (inner agregate sum/ outer aggregate sum), how can i do that?

5 Answers 442 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Frederico
Top achievements
Rank 1
Frederico asked on 20 Jun 2015, 06:31 PM

Hi

Today I have a grid, where each time I aggregate column, it show the sum of an specific column for each agregation.

Now I what to show, together with the aggregated sum, the percentage inner agregate sum/ outer aggregate sum.

Example:

Lets pretend I aggregate columns A and them B.

The footer of aggregation A, should show: "sum agregate A" and "'sum agregate A' / 'sum (total)'"

The footer of aggregation B, should show: "sum agregate B" and "'sum agregate B' / 'sum agregate A'"

How can i do that?

.

 

​

5 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 24 Jun 2015, 02:29 PM
Hello Frederico,

In general, the widget can display total sum of a column, if not group. If the source is grouped, then the grid will display the aggregate per group plus the total aggregated value, as it is shown in this online demo.
If you would like to access the group aggregate in total aggregate, then it will not be possible.

Would it be possible to elaborate a bit more (more numbers will be very helpful) on this requirement?

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
rwb
Top achievements
Rank 2
answered on 05 Aug 2015, 11:26 AM

Out current grid, which we were looking to move to KendoUI Grid, shows totals and sub-totals and percentage when the grid has filtering applied. (Screenshot attached.) (The aggregates are computed on the server as there can be tens of thousands of records in the result set.)

The loss of this feature will be a big problem.

Are there any possible solutions?

Will the Grid component be updated to include this feature?

0
Georgi Krustev
Telerik team
answered on 07 Aug 2015, 08:25 AM
Hello Richard,

The Grid can display custom aggregates, which are calculated on the server without a problem. For instance, here is a Dojo demo that shows this process in a simplified way: In order to use the server aggregation, you will need to set the serverAggregates option to true. Once this is done, define the DataSource schema, which tells where the aggregates are placed. Finally, you will need to define the list of aggregates that will be returned from the server.

With this configuration, the data source is capable to retrieve different custom aggregates that are calculated on the server. To show them in the grid, you just need to define a footerTemplate and render the list of aggregates you have.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
rwb
Top achievements
Rank 2
answered on 07 Aug 2015, 09:55 AM

Thanks for your reply, that's really useful. I can get the original totals by using custom aggregates.

May I suggest that the documentation is updated to make it clear that custom aggregates are possible; it states clearly that:

     The supported aggregates are "average", "count", "max", "min" and "sum".

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.aggregates​

0
Boyan Dimitrov
Telerik team
answered on 11 Aug 2015, 11:50 AM

Hello Richard,

Thank you for your suggestion. 

Since this is the help article for columns.aggregates of Kendo UI Grid only the the built-in aggregates( calculated out of the box) are listed.  They are "average", "count", "max", "min" and "sum". 

Custom aggregates should be defined on data source level, so this is the reason why they are explained in the schema.aggregates of the Kendo UI DataSource. 

Anyway thank you for sharing your feedback with us. 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Frederico
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
rwb
Top achievements
Rank 2
Boyan Dimitrov
Telerik team
Share this question
or