Skip to Content
author's profile photo Former Member
Former Member

Sum () Function

Post Author: Amiro2k

CA Forum: General

Hi,

I'm quite new to Crystal Reports and have to build new inventory reports. In that report I have to use the sum() function but don't know how to do this. The total of items purchased and sold has to be showned on the report but in the database tables they're are divided into 12 month fields on a 2 year span. For exemple Table1.Inv.Purc.Year1.Month01, Table1.Inv.Purc.Year1.Month02, Table1.Inv.Purc.Year1.Month02 up to Month 12 and samething for Table1.Inv.Purc.Year2.Month01. So I have to summarize the content of 12 fields for purchasing and samething for saling. So how do I do that in order to show only the total of purchased items on the report and not every single month?

Thanks in advance.

Steve

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 04:09 PM

    Post Author: bettername

    CA Forum: General

    a formula of:

    sum({Table1.Inv.Purc.Year1.Month01})sum({Table1.Inv.Purc.Year1.Month02})sum({Table1.Inv.Purc.Year1.Month03})+ etc...

    will give the total of all the purchase quantites (assuming that's what's in those fields).

    Does that help?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 04:24 PM

    Post Author: Amiro2k

    CA Forum: General

    Yes it will help but how do I proceed with the report? I mean you show how add all field values but on the printed report I only show the sum of this so do I have to create a vairable?

    Thanks

    Steve

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 04:41 PM

    Post Author: Aman

    CA Forum: General

    Yes, it is suppose to show one sum, this is sum of total purchases and now you will have to input a same formula as above for sold field. Replace the purchase field with sold field.

    Is this what you are asking? and does this help.

    Aman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 04:46 PM

    Post Author: Amiro2k

    CA Forum: General

    Thanks Aman,

    Yes It's what I'm looking for. The way to print the sum only. For other fields all you have to do is adding the field name in the report detail but because of that particular thing, I have to add a field in the report detail and the synthax described before doesn't explain it. I will try this later on today and see...

    Thanks to you all

    Steve

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 06:26 PM

    Post Author: Amiro2k

    CA Forum: General

    Hey Guys,

    I think there is a misunderstanding here. After giving a few tries, I noticed that the solution proposed was not right. I mean I need the sum of all purchasing fields for instance. So there is a number in eache of these 24 fields that I need to sum and show on the report. So I don't need to sum each single field I guess. Here is the output I need

    Product Code - Description - Total purchased - Total sold - Qty on hand

    012345678 Metal Thing 24 21 3

    .......

    So like I said, if I go with the purchasing part, the table has 12 fields wich represent 12 months which have a number in it. I need to sum the 12 fields and show the total only on the report. Looking above, the 24 is the result of the 12 month purchasing process which went like 3 in January, 2 in Feb, 5 in March, 1 in April and so...

    So now, Do I have to go with something like this:

    Var SumOfPurchase = SUM(month1 + month2 + month3 +....)

    Thanks

    Steve

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 06:37 PM

    Post Author: Amiro2k

    CA Forum: General

    Hi,

    Here is what I tried:

    numberVar Summ := {inv2.in2_qte_rec_1_01}{inv2.in2_qte_rec_1_02}{inv2.in2_qte_rec_1_03};

    It works OK. Now I'm facing a more difficult challenge in specifiyng a period like from March 2006 to March 2007. Basically i a situation like that I can't just add all the fields but from field 3 year 1 to field 3 year 2. This is another story I will have to work on because this means programming and I do need more parameters like the supplier for instance...

    Thanks again everybody.

    Steve

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.