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
  • Hi Francesca Shiekh,

    Would you be able to provide a list of your filters, display summaries, and group by selections that I can replicate the report locally to investigate.

  • Hi Francesca Shiekh,

    There is no reason that I can see here why it would be shown twice as you only have one group by column. On the 'Report Details' step would you be able to tick the 'Show Query' checkbox (seen under the Report Name field) and then preview the Report. This will show a list of queries under the Report (in this instance under the summation table) that shows what the Report is using the generate the results.

  • 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

Reply
  • 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

Children