Author Topic: Sum percentage  (Read 1913 times)

vivianteoh

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 6
    • View Profile
Sum percentage
« on: January 08, 2020, 01:22:52 pm »
May I know is there a way to sum percentage correctly?
See sample below:

I have a formula (column B / column A) * 100%. If the result column is summed, the result is shown as 113.06 but what I want is (total of column B / total of column A) * 100% = 0.77.
May I know is there a way to do so?
« Last Edit: January 08, 2020, 01:38:25 pm by vivianteoh »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Sum percentage
« Reply #1 on: January 08, 2020, 11:02:27 pm »
It can be done by writing a column.render callback for affected column and override the cell value in summary row.

Code: [Select]
column.render = function(ui){
 var rd = ui.rowData;
 if(summary row ){
   return rd.B/rd.A * 100
 }
}

vivianteoh

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Sum percentage
« Reply #2 on: January 10, 2020, 09:09:46 am »
Thanks. Will try this out.