Answers.Body: <p>As a result of the input from <a href="https://civicrm.stackexchange.com/users/181/demerit">Demerit</a>, for which many thanks, it seems clear that the Case Summary Report presents inaccurate – or at least potentially misleading – results, arising from the apparent grouping by contact, which is not made clear in the UI.</p>
  
  <p>Making the two suggested changes to the file at CRM/Report/Form/Case/Summary.php as noted in the comments resolves the issue for me, aligning the results from the Case Summary Report with a search based on the same filters/criteria.</p>
  
  <p>This was logged at <a href="http://issues.civicrm.org/jira/browse/CRM-18294" rel="nofollow noreferrer">issues.civicrm.org/jira/browse/CRM-18294</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-29T15:54:58.770Z
Answers.LastActivityDate: 2016-03-29T15:54:58.770Z
Answers.LastEditDate: 2017-04-13T12:53:13.207Z
Answers.UserDisplayName: Graham
Answers.Body: <p>The Case Summary report has a grouping on contact. Do two or more of the cases have the same client?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-24T20:08:01.620Z
Answers.Text: I don't know why it has a grouping on contact. The original one (CiviCRM 3.1?) didn't. And the UI no longer seems to even display the grouping option? You'd only want to group if you were doing something like displaying the count of cases per client. I'd say change $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_c2']}.id"; to $this->_groupBy = ""; in CRM/Report/Case/Form/Summary.php in the groupBy() function and see if that fixes it.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-25T12:44:29.890Z
Answers.Text: Thanks Demerit, this might well resolve my issue. As it is, the report as viewed as a dashlet gives zero indication that any grouping might be occurring, with the effect that it shows an incorrect display, so I'd say, in this version at least, it's a bug. I'll try to reproduce on the demo site.
Answers.UserDisplayName: Graham
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-25T13:11:59.767Z
Answers.Text: I can repeat this issue on both the 4.6 and 4.7 demo sites. Logged at https://issues.civicrm.org/jira/browse/CRM-18294 and included your suggested solution.
Answers.UserDisplayName: Graham
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-25T13:28:18.150Z
Answers.Text: Update: making the edit as suggested to CRM/Report/Form/Case/Summary,php (note the path change) results in the report displaying many thousands of repeat entries (in my case I expected 14 cases to be listed and got 10140 listed instead, with multiple repeats.
Answers.UserDisplayName: Graham
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-26T00:17:16.057Z
Answers.Text: Looks like there's also been an "old-style" join added in the from() function that shouldn't be there. In the else clause, try changing "FROM civicrm_contact $c, civicrm_case $cc" to "FROM civicrm_case $cc".
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-29T15:48:01.380Z
Answers.Text: This works! For my use case at least, which was simply to have a listing of all live cases available on the CiviCRM dashboard. Many thanks Demerit.
Answers.UserDisplayName: Graham
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-24T19:51:18.470Z
Answers.LastActivityDate: 2016-03-24T19:51:18.470Z
Answers.UserDisplayName: Demerit
Body: <p>Using 4.6.10 currently, although aiming to update shortly, I've created a case summary report from the template that simply lists all cases that are either 'ongoing' or 'urgent'. This lists 10 cases. All good.</p>
  
  <p>However, if I then use 'Cases' > 'Find Cases' and specify the exact same criteria (i.e. find all cases with the status 'ongoing' or 'urgent', it lists 14 cases.</p>
  
  <p>Comparing the two results lists and looking for differences between the cases that might explain the difference in results, I can see none. We have only one case type, and all the cases as listed in the civicrm_case table carry the same case type id, they are all open and not deleted, the status id values marry up as I would expect, and I can see no differences that might lead to these four cases not being included in my report.</p>
  
  <p>My assumption/conclusion is that the case summary report template is in some way broken in this version? As I say I'm about to update to the current 4.6.x version (4.6.14 at the time of writing), but wondering if others have had odd results with the Case Summary Report, or indeed the 'Find Cases' search facility?</p>
  
Tags: <civireport><civicase>
Title: Differences in results between 'Find Cases' and a 'Case Report'
ThreadText: # Differences in results between 'Find Cases' and a 'Case Report'
  
  (Asked by: username_0 on 2016-03-23)
  
  Using 4.6.10 currently, although aiming to update shortly, I've created a case summary report from the template that simply lists all cases that are either 'ongoing' or 'urgent'. This lists 10 cases. All good.
  
  However, if I then use 'Cases' > 'Find Cases' and specify the exact same criteria (i.e. find all cases with the status 'ongoing' or 'urgent', it lists 14 cases.
  
  Comparing the two results lists and looking for differences between the cases that might explain the difference in results, I can see none. We have only one case type, and all the cases as listed in the civicrm\_case table carry the same case type id, they are all open and not deleted, the status id values marry up as I would expect, and I can see no differences that might lead to these four cases not being included in my report.
  
  My assumption/conclusion is that the case summary report template is in some way broken in this version? As I say I'm about to update to the current 4.6.x version (4.6.14 at the time of writing), but wondering if others have had odd results with the Case Summary Report, or indeed the 'Find Cases' search facility?
  
  **Tags:** civireport, civicase
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2016-03-29. Score: 2 | Accepted answer
  
  As a result of the input from [username_1](https://civicrm.stackexchange.com/users/181/username_1), for which many thanks, it seems clear that the Case Summary Report presents inaccurate – or at least potentially misleading – results, arising from the apparent grouping by contact, which is not made clear in the UI.
  
  Making the two suggested changes to the file at CRM/Report/Form/Case/Summary.php as noted in the comments resolves the issue for me, aligning the results from the Case Summary Report with a search based on the same filters/criteria.
  
  This was logged at [issues.civicrm.org/jira/browse/CRM-18294](http://issues.civicrm.org/jira/browse/CRM-18294)
  
  
  ---
  
  ### Answer by username_1 on 2016-03-24. Score: 2
  
  The Case Summary report has a grouping on contact. Do two or more of the cases have the same client?
  
  > **Comments:**
  > **username_1**: I don't know why it has a grouping on contact. The original one (CiviCRM 3.1?) didn't. And the UI no longer seems to even display the grouping option? You'd only want to group if you were doing something like displaying the count of cases per client. I'd say change $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_c2']}.id"; to $this->_groupBy = ""; in CRM/Report/Case/Form/Summary.php in the groupBy() function and see if that fixes it.  
  > **username_0**: Thanks username_1, this might well resolve my issue. As it is, the report as viewed as a dashlet gives zero indication that any grouping might be occurring, with the effect that it shows an incorrect display, so I'd say, in this version at least, it's a bug. I'll try to reproduce on the demo site.  
  > **username_0**: I can repeat this issue on both the 4.6 and 4.7 demo sites. Logged at https://issues.civicrm.org/jira/browse/CRM-18294 and included your suggested solution.  
  > **username_0**: Update: making the edit as suggested to CRM/Report/Form/Case/Summary,php (note the path change) results in the report displaying many thousands of repeat entries (in my case I expected 14 cases to be listed and got 10140 listed instead, with multiple repeats.  
  > **username_1**: Looks like there's also been an "old-style" join added in the from() function that shouldn't be there. In the else clause, try changing "FROM civicrm_contact $c, civicrm_case $cc" to "FROM civicrm_case $cc".  
  > **username_0**: This works! For my use case at least, which was simply to have a listing of all live cases available on the CiviCRM dashboard. Many thanks username_1.  
  
  ---
  
  