views:

32

answers:

2

I've got a report that includes some limited duplicate information, there are multiple dates possible, but I want the dollar values to display on only the first item.

IE:

Item 1 - Aug 3, 2010 - Cost $1000
Item 1 - Aug 4, 2010 - (Cost suppressed)
Item 2 - Aug 3, 2010 - $100
Item 3 - Aug 4, 2010 - $200

When this is summed, it should display as $1,300, but instead it displays as $2,300.

I have suppressed the cost section by using a formula:

(
if (Previous({MyReportData;1.MyItemId}) = {MyReportData;1.MyItemId}) then
    true
else
    false
)

This formula works fine.

I have tried to create a formula to perform a custom SUM which will exclude the duplicated items, but it keeps saying "This field cannot be summarized.

Any ideas?

+1  A: 

You have two choices

  1. Modify your SQL to only bring in the data you want. You obviously dont want the row for August 4th 2010. So do not bring it into the report. Then your Summary will work as expected.

  2. Create a running total and evaluate on change of row using the opposite of the suppression formula.

John Hartsock
@John, re #1, I actually need the other data to display (it's more complicated than just the date). I used option #2 and it worked like a charm, just added the running total, with the "evaluate" "on change of field" and then just displayed in the group section. Thanks a bunch. I'll look into this area of Crystal a lot more now
Nathan Koop
Nathan Koop... Running Total Calculation are not very efficient in Crystal Reports. If at all possible handle the calculation in your SQL Query. Easiest way to explain is "The power and speed of the report is not Crystal Report, but the SQL Query used to generate the dataset". Crystal Reports can do many cool things but if you can handle more on the server (SQL Server, Oracle) the report will always run faster. Generally I take the approch of flattening out my dataset to only what is needed and then let the report handle the formatting. I rarely use crystal formulas
John Hartsock
A: 

Another option is to just use global variables to keep track of your sum using the inverse condition you are using to suppress. This should be better, performance-wise, than using Crystal's Running Totals or Summary fields.

Although, I would assume that using a SQL Expression to simply select the rows with the earliest dates by ItemID would be even quicker and would avoid Crystal having to chug through the data.

Ryan