Solved

formula using crosstab fields

Posted on 2004-09-07
10
624 Views
Last Modified: 2008-03-10
i have 2 crosstabs, both are products x months.

so... i want to make a new field that calculates the sum between the total of the first column crosstab #1 and the first column crosttab #2.

More explained, i have these:

Crosstab#1
Product January Feb. March
x              1         2       3
y              5         6       7
total         6          8      10

Crosstab#2
Product January Feb. March
a              5         5        5
b              6          5       4
Total       11        10       9

And I want these:
Total2      17         18     19

THe month columns today are only 3, but next month could be 4, or 6, so i need the total2 field to present the 12 months if it´s necesary and only 3 or 4 if that´s the case.

Please help. i´m just starting to use crystal.
Thanks in advance.
0
Comment
Question by:perfectshark
  • 4
  • 3
  • 2
10 Comments
 
LVL 10

Assisted Solution

by:ebolek
ebolek earned 225 total points
Comment Utility
I know that you want crosstabs but you can achieve this by grouping too

If you have the detail field from the date the sales occure, you can group by that field than by the product id,

You will have two groups.In the desgin view you will roight click the first group and select group by each month. This will group the products by each month.

You will put sums for each group.  Insert , summary,
On chnage of product id, summary
Copy this and paste it to all group footers

These wil lgive you the total of product x for month y
And then you will put a grandtootal to the report footer to find out the total sales for all products for all months

Regards
Emre

0
 
LVL 42

Accepted Solution

by:
frodoman earned 275 total points
Comment Utility
Can you explain the difference between the two crosstabs?  Normally you'd want to create a single crosstab with two entries in the "row" area and then you'd have what you want in a single crosstab like this:

Product January Feb. March
Crosstab#1
   x              1         2       3
   y              5         6       7
total         6          8      10
Crosstab#2
   a              5         5        5
   b              6          5       4
total       11        10       9
Grand Tota2      17         18     19

The key is putting whatever field defines "crosstab #1" and "crosstab #2" into your row area in the crosstab setup.

HTH

frodoman
0
 
LVL 1

Author Comment

by:perfectshark
Comment Utility
the problem is that i don´t always want to add in the grand total, the 2 crosstabs could be 1 for sells and 1 for costs, then i want to substract the two values, then i want to multiply this total for other and get other information.

that´s why i do it in parts.

Thanks again.
0
 
LVL 42

Expert Comment

by:frodoman
Comment Utility
Okay, in that case I have to say that I don't believe what you want isn't directly possible.

You could possibly figure out a way to use formulas to accumulate your totals (although I'm not sure that you could do this, I won't rule it out) but you would need one formula per column which isn't going to work if you have a variable number of columns.  Even techniques such as creating 12 formulas and suppressing the ones you don't need won't work because a crosstab doesn't give you the information you'd need for conditional suppression.

The only way I can think of to achieve the result you want is to create a seperate report that will show only the bottom line totals that you want and then embed this as a subreport in your main report (probably in the report footer).  I don't know if this subreport would be a crosstab or just a normal report - depends on your data structure.

This is an imperfect solution and will likely take tons of effort to make it work correctly but AFAIK that's you're only option.

frodoman
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 1

Author Comment

by:perfectshark
Comment Utility
ok frodoman, i'll try that and tell you if it works,

Two more questions and i close this thing:

i´m not quite sure if it´s possible (or how it´s possible) to change the totals of the crosstab and put another operacion(add, substract, multiply, divide)

2nd:

using crosstab. in one of my crosstab i have this info.

Product January Feb. March
x              1         2       3
y              5         6       7
total         6          8      10

can i make a condition that make all the values in row of product "y" show "0" instead of their actual values?}

so i get .
Product January Feb. March
x               1         2       3
y               0         0       0
total          1         2       3

Thanks.
0
 
LVL 42

Expert Comment

by:frodoman
Comment Utility
I believe this comment answered the question:

Comment from frodoman
Date: 09/08/2004 03:30PM EDT


Last posting from perfectshark was additional questions that should be posted separately.

frodoman
0
 
LVL 10

Expert Comment

by:ebolek
Comment Utility
This comment also answers the question. I would recommend split between Frodoman/ebolek
Comment from ebolek
Date: 09/07/2004 03:49PM PDT

Regards
Emre
0
 
LVL 42

Expert Comment

by:frodoman
Comment Utility
Emre,

I disagree with you on this one.  The original question stated: "THe month columns today are only 3, but next month could be 4, or 6, so i need the total2 field to present the 12 months if it´s necesary and only 3 or 4 if that´s the case.
"

Because of the variable column requirement he needs to use a crosstab.  Your solution would give him totals wanted but would invalidate his stated requirements.

frodoman
0
 
LVL 1

Author Comment

by:perfectshark
Comment Utility
Ok... I found a lot of help with your comments, but none of you give me a true answer to the problem.

The key, was... using a variable to define the sum field in a third crosstab, and make a condition that makes (x and y) positive values and (a and b) negatives values.

Then just needed to hide all the values in the third crosstab except the grand total. And that was it.

As a note, this was the key to make a report i needed to present, i use like 5 variables and 11 crosstabs... i know it should be a better way, but still don´t know it.

Thanks to everyone, i´m gonna split the points.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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 …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now