Body: <p>For each volunteer report run, the Total Time sums in table at the bottom are wrong.</p>
  <p>Row(s) Listed   x
  Total Time Scheduled in Minutes xxx
  Total Time Completed in Minutes xxx</p>
  <p>No matter how sorted or filtered they don't seem to add up.</p>
  <p>As suggested below here is the content of the developer tab.</p>
  <pre><code>```Class used: CRM_Volunteer_Form_VolunteerReport
  </code></pre>
  <pre><code>
  ```SELECT SQL_CALC_FOUND_ROWS project_civireport.title as project_project, civicrm_contact_assignee_civireport.sort_name as civicrm_contact_contact_assignee, activity_civireport.id as civicrm_activity_id, activity_civireport.source_record_id as civicrm_activity_source_record_id, activity_civireport.activity_type_id as civicrm_activity_activity_type_id, activity_civireport.subject as civicrm_activity_activity_subject, activity_civireport.activity_date_time as civicrm_activity_activity_date_time, activity_civireport.status_id as civicrm_activity_status_id, activity_assignment_civireport.contact_id as civicrm_activity_assignment_contact_id, activity_target_civireport.contact_id as civicrm_activity_target_contact_id, activity_source_civireport.contact_id as civicrm_activity_source_contact_id, cg.volunteer_role_id_2 as role_role, cg.time_scheduled_in_minutes_3 as time_scheduled_time_scheduled, cg.time_completed_in_minutes_4 as time_completed_time_completed, case_activity_civireport.case_id as civicrm_case_activity_case_id , civicrm_contact_assignee_civireport.sort_name as civicrm_contact_sort_name  
          
  
  FROM civicrm_activity activity_civireport
               
    LEFT JOIN civicrm_activity_contact  activity_target_civireport
                      ON activity_civireport.id = activity_target_civireport.activity_id AND
                         activity_target_civireport.record_type_id = 3
               
    LEFT JOIN civicrm_value_civivolunteer_1 cg
                      ON activity_civireport.id = cg.entity_id
               
    LEFT JOIN civicrm_volunteer_need n
                      ON n.id = cg.volunteer_need_id_1
               
    LEFT JOIN civicrm_option_value ov_civireport ON ( ov_civireport.value = cg.volunteer_role_id_2 AND ov_civireport.option_group_id = 96 )
               
    LEFT JOIN civicrm_volunteer_project project_civireport
                      ON project_civireport.id = n.project_id
               
    LEFT JOIN civicrm_activity_contact activity_assignment_civireport
                      ON activity_civireport.id = activity_assignment_civireport.activity_id AND
                         activity_assignment_civireport.record_type_id = 1
               
    LEFT JOIN civicrm_activity_contact activity_source_civireport
                      ON activity_civireport.id = activity_source_civireport.activity_id AND
                         activity_source_civireport.record_type_id = 2
               
    LEFT JOIN civicrm_contact contact_civireport
                      ON activity_target_civireport.contact_id = contact_civireport.id
               
    LEFT JOIN civicrm_contact civicrm_contact_assignee_civireport
                      ON activity_assignment_civireport.contact_id = civicrm_contact_assignee_civireport.id
               
    LEFT JOIN civicrm_contact civicrm_contact_source
                      ON activity_source_civireport.contact_id = civicrm_contact_source.id
               
               
    LEFT JOIN civicrm_option_value
                      ON ( activity_civireport.activity_type_id = civicrm_option_value.value )
               
    LEFT JOIN civicrm_option_group
                      ON civicrm_option_group.id = civicrm_option_value.option_group_id
               
    LEFT JOIN civicrm_case_activity case_activity_civireport
                      ON case_activity_civireport.activity_id = activity_civireport.id
               
    LEFT JOIN civicrm_case
                      ON case_activity_civireport.case_id = civicrm_case.id
               
    LEFT JOIN civicrm_case_contact
                      ON civicrm_case_contact.case_id = civicrm_case.id   
  
  WHERE civicrm_option_group.name = 'activity_type' AND
                                  activity_civireport.is_test = 0 AND
                                  activity_civireport.is_deleted = 0 AND
                                  activity_civireport.is_current_revision = 1 AND
                                  activity_civireport.activity_type_id = 66 AND ( activity_date_time &gt;= 20220301000000) AND ( activity_date_time &lt;= 20220331235959) AND ( ( activity_civireport.status_id IN ( '2') ) ) AND (`activity_civireport`.`activity_type_id` IS NULL OR (`activity_civireport`.`activity_type_id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 57, 59, 61, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74)))   
  
  GROUP BY activity_civireport.id  
  
  ORDER BY civicrm_contact_assignee_civireport.sort_name ASC  
  
  LIMIT 0, 50
  </code></pre>
  <p>How can I fix this?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-02T15:09:53.947Z
Comments.Text: Which report template are you using?  Are you using CiviVolunteer? What version of CiviCRM and CiviVolunteer?
Comments.UserDisplayName: Jon G - Megaphone Tech
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-03T18:15:25.570Z
Comments.Text: We have CiviVolunteer and all reports are variations of the stock volunteer report. CiviCRM 5.37.2. I'm unsure of the CiviVolunteer Versionbut we installed it in 2021.
Comments.UserDisplayName: Tom Hennigan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-03T19:48:17.927Z
Comments.Text: Hmm - I'm not using CiviVolunteer at present but I looked and the [statistics code](https://github.com/civicrm/org.civicrm.volunteer/blob/a4a0784eb5cab9ae6a27c9bc209198d1402fb7d5/CRM/Volunteer/Form/VolunteerReport.php#L585-L613) for that report is pretty straightforward - and should be filtering identically to the main report query.  It may help others to troubleshoot if you edit your question to paste the contents of your report's "Developer" tab.  It should be easy enough to spot a discrepancy between the main query and the statistics query.
Comments.UserDisplayName: Jon G - Megaphone Tech
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-04T21:20:44.407Z
Comments.Text: Thanks Jon , pasted it in the question
Comments.UserDisplayName: Tom Hennigan
Tags: <civireport><civivolunteer>
Title: Volunteer Reports Totals Wrong
ThreadText: # Volunteer Reports Totals Wrong
  
  (Asked by: username_0 on 2022-02-28)
  
  For each volunteer report run, the Total Time sums in table at the bottom are wrong.
  Row(s) Listed   x
  Total Time Scheduled in Minutes xxx
  Total Time Completed in Minutes xxx
  No matter how sorted or filtered they don't seem to add up.
  As suggested below here is the content of the developer tab.
  ```Class used: CRM_Volunteer_Form_VolunteerReport
  
  
  ```SELECT SQL_CALC_FOUND_ROWS project_civireport.title as project_project, civicrm_contact_assignee_civireport.sort_name as civicrm_contact_contact_assignee, activity_civireport.id as civicrm_activity_id, activity_civireport.source_record_id as civicrm_activity_source_record_id, activity_civireport.activity_type_id as civicrm_activity_activity_type_id, activity_civireport.subject as civicrm_activity_activity_subject, activity_civireport.activity_date_time as civicrm_activity_activity_date_time, activity_civireport.status_id as civicrm_activity_status_id, activity_assignment_civireport.contact_id as civicrm_activity_assignment_contact_id, activity_target_civireport.contact_id as civicrm_activity_target_contact_id, activity_source_civireport.contact_id as civicrm_activity_source_contact_id, cg.volunteer_role_id_2 as role_role, cg.time_scheduled_in_minutes_3 as time_scheduled_time_scheduled, cg.time_completed_in_minutes_4 as time_completed_time_completed, case_activity_civireport.case_id as civicrm_case_activity_case_id , civicrm_contact_assignee_civireport.sort_name as civicrm_contact_sort_name  
          
  
  FROM civicrm_activity activity_civireport
               
    LEFT JOIN civicrm_activity_contact  activity_target_civireport
                      ON activity_civireport.id = activity_target_civireport.activity_id AND
                         activity_target_civireport.record_type_id = 3
               
    LEFT JOIN civicrm_value_civivolunteer_1 cg
                      ON activity_civireport.id = cg.entity_id
               
    LEFT JOIN civicrm_volunteer_need n
                      ON n.id = cg.volunteer_need_id_1
               
    LEFT JOIN civicrm_option_value ov_civireport ON ( ov_civireport.value = cg.volunteer_role_id_2 AND ov_civireport.option_group_id = 96 )
               
    LEFT JOIN civicrm_volunteer_project project_civireport
                      ON project_civireport.id = n.project_id
               
    LEFT JOIN civicrm_activity_contact activity_assignment_civireport
                      ON activity_civireport.id = activity_assignment_civireport.activity_id AND
                         activity_assignment_civireport.record_type_id = 1
               
    LEFT JOIN civicrm_activity_contact activity_source_civireport
                      ON activity_civireport.id = activity_source_civireport.activity_id AND
                         activity_source_civireport.record_type_id = 2
               
    LEFT JOIN civicrm_contact contact_civireport
                      ON activity_target_civireport.contact_id = contact_civireport.id
               
    LEFT JOIN civicrm_contact civicrm_contact_assignee_civireport
                      ON activity_assignment_civireport.contact_id = civicrm_contact_assignee_civireport.id
               
    LEFT JOIN civicrm_contact civicrm_contact_source
                      ON activity_source_civireport.contact_id = civicrm_contact_source.id
               
               
    LEFT JOIN civicrm_option_value
                      ON ( activity_civireport.activity_type_id = civicrm_option_value.value )
               
    LEFT JOIN civicrm_option_group
                      ON civicrm_option_group.id = civicrm_option_value.option_group_id
               
    LEFT JOIN civicrm_case_activity case_activity_civireport
                      ON case_activity_civireport.activity_id = activity_civireport.id
               
    LEFT JOIN civicrm_case
                      ON case_activity_civireport.case_id = civicrm_case.id
               
    LEFT JOIN civicrm_case_contact
                      ON civicrm_case_contact.case_id = civicrm_case.id   
  
  WHERE civicrm_option_group.name = 'activity_type' AND
                                  activity_civireport.is_test = 0 AND
                                  activity_civireport.is_deleted = 0 AND
                                  activity_civireport.is_current_revision = 1 AND
                                  activity_civireport.activity_type_id = 66 AND ( activity_date_time >= 20220301000000) AND ( activity_date_time <= 20220331235959) AND ( ( activity_civireport.status_id IN ( '2') ) ) AND (`activity_civireport`.`activity_type_id` IS NULL OR (`activity_civireport`.`activity_type_id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 57, 59, 61, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74)))   
  
  GROUP BY activity_civireport.id  
  
  ORDER BY civicrm_contact_assignee_civireport.sort_name ASC  
  
  LIMIT 0, 50
  
  How can I fix this?
  
  **Tags:** civireport, civivolunteer
  
  > **Comments:**
  > **username_1**: Which report template are you using?  Are you using CiviVolunteer? What version of CiviCRM and CiviVolunteer?  
  > **username_0**: We have CiviVolunteer and all reports are variations of the stock volunteer report. CiviCRM 5.37.2. I'm unsure of the CiviVolunteer Versionbut we installed it in 2021.  
  > **username_1**: Hmm - I'm not using CiviVolunteer at present but I looked and the [statistics code](https://github.com/civicrm/org.civicrm.volunteer/blob/a4a0784eb5cab9ae6a27c9bc209198d1402fb7d5/CRM/Volunteer/Form/VolunteerReport.php#L585-L613) for that report is pretty straightforward - and should be filtering identically to the main report query.  It may help others to troubleshoot if you edit your question to paste the contents of your report's "Developer" tab.  It should be easy enough to spot a discrepancy between the main query and the statistics query.  
  > **username_0**: Thanks Jon , pasted it in the question  
  
  ---
  
  ## 0 answers
  
  