[RESOLVED] Condition sum function-VBForums
Results 1 to 5 of 5

Thread: [RESOLVED] Condition sum function

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    382

    Resolved [RESOLVED] Condition sum function

    In crystal report, for data showing at below:

    QUANTITY----PAID_DAY
    12------------2/2/2010
    35------------
    63------------5/15/2010
    13------------

    How to add code to sum of Quantity if there is a day in [PAID_DAY]?
    The result showing on the report should be 12+63=75.

  2. #2
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,868

    Re: Condition sum function

    Is the field 'PAID_DAY', date data type ?

    If so, then You could sum 'QUANTITY' using :
    a)RunningTotal field
    or
    b)Formulas

    Wichever You decide, the condition should be
    Code:
    {Table.PAID_DAY} <> Date(0,0,0)
    JG

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    382

    Re: Condition sum function

    I tried to add a formula @quatity and drag it to group fooder of Order:

    IF {Table.PAID_DAY} <> Date(0,0,0)
    THEN SUM({Table.QUANTITY})

    But did not see the result showing. Something wrong with my doing?

  4. #4
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,868

    Re: Condition sum function

    No, You should
    1
    add a formula field with next code
    Code:
    IF {Table.PAID_DAY} <> Date(0,0,0) THEN {Table.QUANTITY} Else 0
    Place in detail section
    Format the formula field to 'Supress'
    Add a Summary to this formula field for the desired group

    or

    2
    Insert a Running Total Field
    Select the field
    Evaluate using a formula
    Click on x-2 button, it open the formula editor
    Write the next condition
    Code:
    {Table.PAID_DAY} <> Date(0,0,0)
    Reset in the desired change of group
    and place the Running Total field in the desired group footer

    JG

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    382

    Re: Condition sum function

    It works. Thank you so much.
    I learned a lot of how to add a formula from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.