Calculate Measures in a PivotGrid

1 Answer 34 Views
PivotGrid
Ludovic
Top achievements
Rank 1
Ludovic asked on 28 Oct 2021, 02:10 PM

Hello,

 

I'm trying to use a pivotgrid where a ratio is calculated, but I can find a way to do it, as the Total is always wrong.

Example : I don't know how to calculate the cell with "?"

 

| Object 1                             | Object 2                             | Total Object                     |

| Value 1  |  Value 2 | Ratio | Value 1  |  Value 2 | Ratio | Value 1  |  Value 2 | Ratio |

01/01/2021      | 15           |  12          |  0.8    |  15          |  6          |  0.4     | 30          | 18           | ?        |

02/01/2021     | 16           |  10          |  0.625|  12          |  6          |  0.5     | 28          | 16           | ?        |

Total Date      | 31            |  22          |  ?       |  27          |  12         |    ?     | 58          | 34           | ?        |

 

Thanks for your help

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 02 Nov 2021, 01:08 PM

Hello Ludovic,

The built-in measures are average, count, max, min, sum. For custom measure calculations (e.g., ratio), you can use "aggregate" and "result" functions in the measure's configuration. Here's a dojo example that demonstrates this: https://dojo.telerik.com/iqAQeRAQ

The approach in the MVC PivotGrid would be similar. The measure's "aggregate" and "result" handlers are attached as shown below:

.Aggregate("aggregateHandler").Result("resultHandler");

Regards,
Ivan Danchev
Progress Telerik

Remote troubleshooting is now easier with Telerik Fiddler Jam. Get the full context to end-users' issues in just three steps! Start your trial here - https://www.telerik.com/fiddler-jam.
Tags
PivotGrid
Asked by
Ludovic
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or