Skip to content

Guide · Crystal Reports

Crystal report showing duplicate rows or totals that run high

The same invoice prints two or three times, or freight and tax add up to more than Sage says they should. It's the most common thing wrong with a Crystal report, and it nearly always has the same cause.

Updated

The short version.

It's almost always a one-to-many link. Link an invoice header to its lines and every header value repeats once for each line. Sum a header amount such as freight across those rows and the total runs high. The fix is to make the report count each header once: with a running total, a group-level layout, or a different way of fetching the data.

Why it happens

Four ways a link changes your numbers.

A header linked to its lines

In a one-to-many link, the values from the header table are repeated for each matching detail record. A three-line invoice becomes three rows, each carrying the full freight, tax, and invoice total.

Two detail tables on one header

Link an invoice to its lines and also to its payments, and the rows multiply: three lines and two payments make six rows. Every amount on the report is now overstated.

Hidden rows still counted

Suppressing a section, or using Suppress If Duplicated on a field, hides what prints. The hidden rows are still in the totals.

The reverse: rows that go missing

An inner link keeps only records with a match on both sides, so an invoice with no lines drops off the report. The link's options are Inner, Left Outer, Right Outer, and Full Outer, and the wrong one loses rows instead of repeating them.

Find it

Confirm the cause before you change anything.

  1. Look at the raw rows

    Put the header's key (the invoice number, say) and the amount that's wrong in the Details section, and look for the same key on more than one row.

  2. Check the links

    Open Database > Database Expert and go to the Links tab. Look for a header table linked to a detail table, or to two of them.

  3. Check what's being summed

    A sum of a detail field, such as a line amount, is usually fine. A sum of a header field, such as freight, tax, or the invoice total, is the one that runs high.

  4. Get a number you trust

    Run Sage's own standard report for the same period, or total a handful of invoices by hand. You'll need it to know when the fix is right.

Fix it

The fixes, from lightest to heaviest.

A running total that counts each header once

In the Field Explorer, right-click Running Total Fields and choose New. Summarize the header amount, set Evaluate to "On change of field" and pick the header's key, and set Reset to "On change of group" if you need a total per group.

Group on the header and suppress the details

Group the report on the header's unique ID, show the header fields in the group header or footer, and suppress the Details section. Each header then prints once.

Move the second detail table to a subreport

When two detail tables multiply each other, take one out of the main report and show it in a subreport linked on the header's key.

Let the database do the totaling

Database Expert > Add Command lets you write the query yourself, so the database returns one row per header with the detail already totaled.

Select Distinct Records, sometimes

Database > Select Distinct Records removes rows that are identical in every field the report uses, so it helps only when no detail field is on the report. It's greyed out for stored procedures and command objects.

Check it

How to know the fix is right.

  • The grand total matches Sage's own report for the same period
  • Subtotals add up to the grand total
  • An invoice with one line and an invoice with many are both right
  • Changing the sort order doesn't change any total
  • Nothing that should print has disappeared

Want it fixed and checked?

Send me the report and the number it should show. I find which link is doing it, fix it, and check the result against numbers you already trust. You get a fixed price once I've seen the report, before any work starts.

Tell Me What You're Seeing

Questions

Duplicate row questions.

Can I just hide the duplicate rows?
You can hide them, but that doesn't fix the totals. Suppressing a section or a repeated field changes what prints, and the hidden rows are still summed.
Why does only freight or tax come out wrong?
Because those amounts sit on the header, not on the lines. Line amounts appear once per row and sum correctly; header amounts repeat on every line and get added again each time.
Does this happen in every Sage product?
Yes, wherever a header table is linked to a detail table. In Sage 100, for example, freight and sales tax sit on the invoice history header and repeat on every detail row once the two are joined.
How much does it cost to have this fixed?
It depends on the report, so the price comes after I've seen it. It's a fixed price, and you know it before any work starts.

Contact

Tell me what you need.

Tell me about your project or the problem you need solved.

Email me at andy@codingandy.com, text or leave a voicemail at 612-249-6882, or use the form.

Add project details (optional)Company, phone, Sage product, and type of request1 added

Sage product

Optional. Skip it if your request isn't about Sage.

What do you need?

No retainer, no obligation. You'll get a scope and price before any work starts, and I never contact your current Sage partner without your permission.