Function Help! Sum an item by date and by category - InfoPath Dev
in

InfoPath Dev

Function Help! Sum an item by date and by category

Last post 10-27-2009 08:21 AM by brjan999. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-22-2009 07:36 AM

    Function Help! Sum an item by date and by category

    Hi Everyone,

     I am trying to sum (dollar amount) by date and category that it is in.  For example, let's say I have three categories of expenses: meals, gas, office supplies, and I want to sum a total for each of these items by date.  Let's say I have a (3) meal expenses on 10/21, (2) meal expenses on 10/22, (1) gas expense on 10/21, (3) office supplies purchase on 10/21, and (2) office supplies on 10/22.  All I am concerned about is meals, so what I want to do is a sum formula that looks only at the meals category and sums the total dollar amount by date.  Something like this:

     Meals for 10/21
    1. $5.00
    2. $10.00
    3. $15.00

    Meals for 10/22
    1. $8.00
    2. $10.00

     Date                          Expense                     Amount
    10/21                         Meals                           $30.00
    10/22                         Meals                           $18.00

     Any help would be appreciated.  Thanks again for your time.

    Bryan

  • 10-25-2009 11:57 PM In reply to

    Re: Function Help! Sum an item by date and by category

    hi brjan999,

    can you please mention a little bit about the implementation part, whether you have used repeating tables or not, how you want categories to be summed and how you want the totals for days to be summed

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 10-26-2009 07:03 AM In reply to

    Re: Function Help! Sum an item by date and by category

    Hi Qazi, 

    Thank you for the reply.  I am using repeating tables.  I will see if I can note what I am doing.

    1st Repeating Table
    Date                             Expense Type                           Cost
    10/22                           Office Supplies                          $5.00
    10/22                           Meals                                       $10.00
    10/22                           Auto                                         $7.00
    10/22                           Meals                                       $5.00
    10/23                           Auto                                         $8.00
    10/23                           Office Supplies                          $10.00
    10/23                           Meals                                       $4.00
    10/23                           Meals                                       $5.00

     2nd Repeating Table (Sums by date and only by the meals category)
    Date                             Expense Type                           Cost
    10/22                           Meals                                       $15.00
    10/23                           Meals                                       $9.00

    I have successfully built the functionality required to group by date and if it is in the meal expense, but I can't seem to create a forumla that will just sum the meal expense by date.  It is adding all expenses together by date.  For example, I should have $15.00 on 10/22 for meals, but because I don't know how to write the formula it will take all of the expenses on 10/22 and add them together, so it would look like I spent $27.00 on 10/22 for meals.  I hope that I was able to clarify the issue.  Thanks again for your help.

    Here is the formula that I was using:

    sum(CostA[DateA = current()/../DateA]) 

    I just don't know how to say "Sum cost by date if it is in the meals category."

     Have a great day,

    Bryan

  • 10-27-2009 05:54 AM In reply to

    Re: Function Help! Sum an item by date and by category

    formula sum(field3[field2 = current()/../field5 and field1 = current()/../field4])

    field 1 = date of first table 

    field2 = expense type of first table

    field3 = cost of first table

    field4 = date of second table 

    field5 = expense type of second table

    field6 = cost of second table

     

     

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 10-27-2009 08:21 AM In reply to

    Re: Function Help! Sum an item by date and by category

    Great.  Thank you for your help.  I'll play around with it.  Thanks again!

    -Bryan

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.