Summation Report bug?

I have a summation report with bar chart number of cases by date (day).

The results table shows duplicate and missing dates.

I did a show query and when I cut and paste the sql in mysql workbench on the same database instance I get different results from what I see in the report.

Any thoughts on why reports does not have the correct data?

Note 3/10 has 43 cases and 3/9 has 65 cases in MySql

while on the report

3/10 is there twice with 50 and 43 cases respectively

Similarly for 3/5 and 3/6.

From MySql:

cases.jpg

From Report:

fromReport.jpg

thanks,
FrancescaS

Parents Reply Children
  • Yes, that's what I did and how I got the query to run in mysql, that's where things get strange, the same exact query gives different results in reports than it does in straight sql.

    The only oddity in the query is this portion of the where statement:

    OR (cases_cstm.case_closed_reason_c IS NULL AND 'Spam' IS NOT NULL)

    this is the line item query from show sql:

    SELECT DATE_FORMAT(cases.date_entered - INTERVAL 360 MINUTE,'%Y-%m-%d') cases_day_date_entered,DATE_FORMAT(cases.date_entered,'%Y-%m-%d %H:%i:%s') cases_dayreal_date_entered,COUNT(cases.id) cases__allcount, COUNT(DISTINCT cases.id) cases__count

    FROM cases

    LEFT JOIN cases_cstm cases_cstm ON cases.id = cases_cstm.id_c

    WHERE (((cases_cstm.case_department_c = 'TS'

    ) AND (cases_cstm.case_closed_reason_c <> 'Spam' OR (cases_cstm.case_closed_reason_c IS NULL AND 'Spam' IS NOT NULL)) AND (cases.date_entered >= '2016-02-17 06:00:00' AND cases.date_entered <= '2016-03-18 04:59:59'

    )))

    AND cases.deleted=0

    GROUP BY DATE_FORMAT(cases.date_entered - INTERVAL 360 MINUTE,'%Y-%m-%d')

      ORDER BY cases_day_date_entered ASC

    and for the totals:

    SELECT COUNT(cases.id) cases__allcount, COUNT(DISTINCT cases.id) cases__count

    FROM cases

    LEFT JOIN cases_cstm cases_cstm ON cases.id = cases_cstm.id_c

    WHERE (((cases_cstm.case_department_c = 'TS'

    ) AND (cases_cstm.case_closed_reason_c <> 'Spam' OR (cases_cstm.case_closed_reason_c IS NULL AND 'Spam' IS NOT NULL)) AND (cases.date_entered >= '2016-02-17 06:00:00' AND cases.date_entered <= '2016-03-18 04:59:59'

    )))

    AND cases.deleted=0

  • I can reproduce the problem consistently in V7.6.2.1

    It appears to be a display issue, not a query issue.

    I think it's a bug in Reports. Alex Nassi do you know of any Reports bugs that might account for this?

    thanks,

    Francesca

  • May be related to:

    Defect 75640: Report Summation with Details showing duplicate groups: SugarCRM, Inc.

  • Will be interesting to see what Alex Nassi says as I have tried this on a fresh demo instance for version 7.6.2.1 Enterprise that has no filters and simply groups on the day of the Date Created, and it correctly shows a single row for each date of:

    • 20/09/2013 -> 247 records
    • 11/06/2015 -> 2 records
    • 15/06/2015 -> 4 records
    • 17/06/2015 -> 4 records