diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php
index 0f70db4a57a8b6a6c2a59d677c602cc1ea565222..73c4f561f16accf267a27759e4551474878891c7 100644
--- a/CRM/Report/Form.php
+++ b/CRM/Report/Form.php
@@ -2412,12 +2412,6 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
       }
     }
 
-    // build array of section totals
-    $this->sectionTotals();
-
-    // process grand-total row
-    $this->grandTotal($rows);
-
     // Find alter display functions.
     $firstRow = reset($rows);
     if ($firstRow) {
@@ -2458,6 +2452,12 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
     $this->alterDisplay($rows);
     CRM_Utils_Hook::alterReportVar('rows', $rows, $this);
 
+    // build array of section totals
+    $this->sectionTotals();
+
+    // process grand-total row
+    $this->grandTotal($rows);
+
     // use this method for formatting custom rows for display purpose.
     $this->alterCustomDataDisplay($rows);
   }