Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Duplicates in Crosstab Post Reply Post New Topic
Author Message
idrow
Newbie
Newbie


Joined: 25 Jan 2011
Location: United States
Online Status: Offline
Posts: 4
Quote idrow Replybullet Topic: Duplicates in Crosstab
     Posted: 25 Jan 2011 at 6:39am
I have 2 tables that I am linking, a budget table to an invoice table.

Budget table ex.:
Custno NovBudget DecBudget JanBudget
12345       500            600            500


Invoice table ex.:
Custno   date          InvAmt
12345   11/2010        300
12345   11/2010        300
67890   11/2010        600

As you can see, there are 2 invoices in Nov. to the 1 entry for the budget on cust 12345.  My problem is that instead of giving me a budget amount of 500, it's stating 1,000 because it's giving me a budget record for each invoice when I only need it once.

I am using 'select distinct', but that's not working.  I tried using a running total for the budget to break on change of custno.  That works BUT when I try to use that running total in a formula to calculate the difference between the invoice amount and the budget amount, I get the following error:
"A print time formula that modifies variables is used in a chart or map"

I tried creating a formula using the average of budget:    {Invoice.InvAmt} - Average({@Budget})  //where @Budget determines which budget column amount to use based on monthly parameters entered, but it's still giving me 1,000

How can I get the budget to only print once on the report while also allowing to use that budget amount in another formula?

If it makes a difference, I'm using the cross-tab feature and the column is on Invoice.date summarizing for each month.  The rows are for each custno:
      Invoiced Amt
      Budget
      Budget Dif
      Budget Dif %

Any help would be greatly appreciated - I'm banging my head over here.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 25 Jan 2011 at 11:13am
You could try using Max or Min on the budget values instead of Average or Sum.  If all of the budget values are the same for the month, this should give you what you're looking for.
 
-Dell
IP IP Logged
idrow
Newbie
Newbie


Joined: 25 Jan 2011
Location: United States
Online Status: Offline
Posts: 4
Quote idrow Replybullet Posted: 26 Jan 2011 at 9:47am
Unfortunately, this does not work even though the budget values are the same. It returned a huge number when used as follows:

{Invoice.Amount} - Maximum({@Budget})

I expected to see $30 and it returned approx.  $400,000
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum