Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Multiple filter in Crystal Report

I have a table specified like the following:
     Column Name          Data Type
     K                    Number
     V                    Number
I want to use Crystal Report to report results below:
     - A field which contains Sum of V where K is in 1 to 2.
     - A field which contains Sum of V where K is in 3 to 4.
What should I do?
Can anyone help me?
Thanks in advance.
0
rock2003
Asked:
rock2003
  • 2
  • 2
1 Solution
 
mlmccCommented:
Use a running total.

Open the report
Create a new running total
Give the running total a name - V_Sum12
Field to summarize - V
Type of summary - SUM
Evaluate - Use a formula - K >= 1 and K <= 2
Reset - Never

Do a similar formula for the other case

mlmcc

0
 
srini_jgCommented:
Create two formula fiedls. FORK12 and FORk34

FORK12 should read as
    if k = 1 or k = 2 then
       v
    else
   0
FORK34 shold read as
    if k = 3 or k = 4 then
       v
    else
    0
Place these in the details sections as two fields.

You can then insert the sum for these fields in the Group Footer / Grand Total.

Srini
0
 
rock2003Author Commented:
Hi, mlmcc!
Suppose that data of the table were:
     (K, V) = {(1,1), (2,2), (3,3), (4,4)}
I create 2 running total field as you suggest. Then I put them into the Report Header section (not the Details section).
When I preview the report, it shows wrong results like the following:
       V_Sum12: 1
       V_Sum34: null
Can you help me shoot this problem?
Thanks.
0
 
rock2003Author Commented:
Thanks a lot for your answers, Srini_jg.
0
 
mlmccCommented:
The running totals get calculated as the report runs.  Putting them in the header only accounts for the first record.  Totals were correct.

Try putting them in the report footer.

mlmcc
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now