CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Summing Groups

  1. #1
    Join Date
    Dec 2007
    Posts
    1

    Post Summing Groups

    I am wanting to total the invoices of a particular Purchase Order (PO#). Then determine if the PO# falls into a specific category (formula field) based on the size of the order, or sum of invoices.

    I have grouped the invoices under the PO# and set a summary for the group. Now I want to test whether the PO# total is < 5000 or >= 5000. Individually the invoices may not reach the $5000 threshold, but the sum may.

    Ideally, this is the result I would like...

    PO#______Invoice__________Category__________Sales
    123______________________>= 5000__________5650.00
    __123_____inv123___________< 5000__________2000.00
    __123_____inv124___________< 5000___________150.00
    __123_____inv125___________< 5000__________3500.00

    I cannot figure this out.
    Last edited by preeves7001; December 27th, 2007 at 05:14 PM. Reason: Provide example of results desired

  2. #2
    Join Date
    May 2006
    Posts
    324

    Re: Summing Groups

    See the help on the Sum() function. Put something like the following into the group header formula to set the category column:
    local numbervar po_total := Sum({table.invoice_amount}, {table.po_number});
    if po_total < 5000 then "xxx" else "yyy"

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured