i have a requirement like this,in my working project,

for (Sobject aggregrate: aggregratecountList) {
            totalCount = Integer.valueOf(aggregrate.get('ID'));
percent = decimalaggregate.Divide(totalCount, 2);

the percentage is showing as 50: instead of 100,

  • pls suggest me how to do it'' – Satya Apr 25 '16 at 11:06
  • how to calculate the percentage of total records using id. – Satya Apr 25 '16 at 11:06
  • 2
    It is not quite clear to me what you're asking. The subject mentions 'count of ids', one of your comments mentions 'percentage' and your code divides by 2. I would suggest editing your own question to indicate what your requirements are, what you've tried, and what doesn't work. That's the best way to get help from this community. – mkorman Apr 25 '16 at 11:49

you only created Divide method in decimalaggregate class and called it

   decimalaggregate.Divide(totalCount, 2).

You get some if using SOQL get their count, and get total no of records of that data type existing in the system.

then just put them in simple percentage formula.

| improve this answer | |
  • yes am trying in different ways,if i put write divide also am not not getting 100:%' – Satya Apr 25 '16 at 11:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.