Solved

# Sum of the group based on condition

Posted on 2011-02-14
688 Views
I need to calculate the sum of the group1 in crystal report.The report is like this.
Group1 is TypeID
Group2 is MemberID
Group2 has Details section.It has fields like Name,TransactionDate and Balance.

It looks as follows:
Details Name  Transactiondate   Balance
123        02/13/2011          \$100
123        02/13/2011          \$100
Details Name       Transactiondate   Balance
345        02/13/2011        \$200
345        02/13/2011        \$200
345        02/13/2011        \$200
Details Name       Transactiondate   Balance
----         ---------                 ----
Group1Footer Sum for Group1 Sum(Balance)= \$300

The sum has to consider only one record in each details section.Because the balance is repeating for the same member.
So, I need to consider it only once.
How to do this. Please let me know.

Thanks
0
Question by:KavyaVS

LVL 100

Assisted Solution

mlmcc earned 100 total points
ID: 34893130
Try this

WhilePrintingRecords;
Global NumberVar grpTotal;
grpTotal := 0;
""

WhilePrintingRecords;
Global NumberVar grpTotal;
grpTotal := grpTotal  + {BalanceField};
""

In the group1 footer
WhilePrintingRecords;
Global NumberVar grpTotal;
grpTotal

mlmcc
0

LVL 34

Accepted Solution

James0628 earned 400 total points
ID: 34894639
You could also use a running total.  Right-click on the Balance field and select Insert > "Running Total".  Under Evaluate, select "On change of group" and select group 2.  Under Reset, select "On change of group" and select group 1.  Click OK to add the running total field and put it in your group 1 footer.

James
0

## Featured Post

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…