Inverse of the Sum function

Post Author: deejayw
CA Forum: Formula
Hi,I am trying to create a formula which works like the Sum function but will give me the difference between two amounts.Scenario:Each record has a username, invoice date and invoice amount. My data set contains two months of data which means for each username, i have two invoice amounts and invoice dates. I know the Sum function will add values together but how can i get the difference between two values, namely last months invoice amount and this months invoice amount (order is important).Do i need to use an array or is my brain so fried that i'm missing something simple?Thanks 

Post Author: satyanat
CA Forum: Formula
Hi,
Instead of having the two months invoice details in a single query you can write it as two queries, one to pull the current month invoice date,amount and the other one to pull the previous month Invoice. you can link both queries on User name through visual link.
Now you can easily find the difference between the two invoice amounts.
ex: {previousmonth.invoiceamt} - {currentmonth.invoiceamt}
Try this option.
Regards,
Natarajan

Similar Messages

  • How can I sum up raws? the sum function seems to work for columns only and right now I have to create a separate formula for each raw

    How can I sum up raws? the Sum function seems to work only on columns. Right now I have to create a separate formula for each raw

    Hi dah,
    "Thanks, but can I do one formula for all present and future raws? as raws are being added, I have to do the sum function again and again"
    You do need a separate formula for each group of values to be summed.
    If the values are in columns, you need a copy of the formula for each column.
    If the values are in rows, you need a copy of the formula for for each row.
    If you set up your formulas as SGIII did in his example (shown below), where every non-header row has the same formula, Numbers will automtically add the formula to new rows as you add them.
    "Same formula" in this context means exactly the same as all the formulas above, with one exception: the row reference in each formula is incremented (by Numbers) to match the row containing the formula.
    Here the formula looks like this in the three rows shown.
    B2: =SUM(2)
    B3: =SUM(3)
    B4: =SUM(4)
    That pattern will continue as rows are added to the table.
    Also, because the row token (2) references all of the non-header cells in row 2, the formula will automatically include new columns as they are added to the table.
    Regards,
    Barry

  • XML Data template. Using the SUM() function

    Hi there,
    I have a data template where I want to create a summary column based on the child group.
    *<group name="G_RO_ESTIMATES" source="Q_RO_ESTIMATES">
    <element name="ESTIMATE_TOTAL" value="G_RO_ESTIMATE_LINES.CHARGE" function="SUM()" />
    <group name="G_RO_ESTIMATE_LINES" source="Q_RO_ESTIMATE_LINES">
    <element name="CHARGE" value="CHARGE" />
    </group>
    </group>*
    ESTIMATE_TOTAL returns 0
    even though the value of the CHARGE column is 760.
    I got the SUM() function to work on another group further down in my data template but for some reason this will not work.
    Does anyone have a clue on what's wrong?
    Thank you in advance.
    BR Kenneth

    give the name of the element diff as CHARGE_TEST
    *<group name="G_RO_ESTIMATES" source="Q_RO_ESTIMATES">
    <element name="ESTIMATE_TOTAL_TEST" value="G_RO_ESTIMATE_LINES_GRP.CHARGE_TEST" function="SUM()" />
    <group name="G_RO_ESTIMATE_LINES_GRP" source="Q_RO_ESTIMATE_LINES">
    <element name="CHARGE_TEST" value="CHARGE" />
    </group>
    </group>*
    sometimes the name get overlapped which results in zero.. keep the names unique
    (i guess , i already logged a bug for this sometime back)

  • The sum function requires 1 argument(s).

    ---Hi i am trying get all of
    (sum(Q.SCTOTAL,0)) as SC,
    (sum(Q.SRTOTAL,0)) as SRTOTAL,
    (sum(Q.CminusREF,0))as CminusREF,
    (sum(Q.SFAT,0))as SFAT,
    (sum(Q.SPAT,0))as SPAT,
    (sum(Q.SNOTATPT,0))as SNOTATPT,
    (sum(Q.SET,0))as SET,
    (sum(Q.TOTAV,0))as TOTAV
    and for each emp_name?
    but it is not wotking for me. the error says: The sum function requires 1 argument(s).
    what shoould i change on the code below so mY Query can Run?
    thank you
    B.
    select distinct
    G.Emp_name,
    upper(G.EMP_case_number) as MIS_EMP_case_NO,
    G.Emp_name as Emp,
    G.MIS_Emp_id,Radius,
    G.address,
    G.DC as Emp_DC,
    G.Emp_class,
    Q.YEAR,
    Q.EMP_case_number,
    (sum(Q.SCTOTAL,0)) as SC,
    (sum(Q.SRTOTAL,0)) as SRTOTAL,
    (sum(Q.CminusREF,0))as CminusREF,
    (sum(Q.SFAT,0))as SFAT,
    (sum(Q.SPAT,0))as SPAT,
    (sum(Q.SNOTATPT,0))as SNOTATPT,
    (sum(Q.SET,0))as SET,
    (sum(Q.TOTAV,0))as TOTAV
    FROM tbl_MIS_QC G
    LEFT JOIN QCPFA Q ----View
    ON upper(Q.EMP_case_number) = upper(G.EMP_case_number)
    where DC = '55'
    gorup by G.Emp_name
    order by G.Emp_name, upper(G.EMP_case_number)

    Hi,
    It's true: the SUM function only takes one argument. What are you trying to do with the second argument, 0?
    When you use aggregate functions (like SUM), everything in the SELECT clause must be an aggregate function, a constant, or one of the GROUP BY columns. Without knowing your tables, your data, or what results you want, I can't tell you exactly what to do. You might want to compute the SUMs in a sub-query before joining them to the other table, something like this:
    select  G.Emp_name,
            upper(G.EMP_case_number) as MIS_EMP_case_NO,
            G.Emp_name as Emp,
            G.MIS_Emp_id,Radius,
            G.address,
            G.DC as Emp_DC,
            G.Emp_class,
            Q.YEAR,
            Q.upper_EMP_case_number,
            q.sc,
            q.srtotal,
    FROM    tbl_MIS_QC G
    LEFT JOIN
            (   -- Begin in-line view q
            SELECT  year,
                    UPPER (emp_case_number) AS upper_emp_case_number,
                    sum(SCTOTAL) as SC,
                    sum(SRTOTAL) as SRTOTAL,
            FROM    QCPFA
            GROUP BY  year,
                      UPPER (emp_case_number)
            )   -- End in-line view q
    ON Q.upper_EMP_case_number = upper(G.EMP_case_number)
    where DC = '55'
    order by G.Emp_name, upper(G.EMP_case_number) Repeat: this is just a wild guess, the best I can do without seeing some test data and the results you want from that data.

  • Why does the sum function not work when I try to add a column of decimal numbers?  The value is always returned as 0.  No problem with whole numbers but decimals do not work!

    just bought a MacBook Air and using Numbers to make a spreadsheet for financial purposes.  The sum function is working ok for whole numbers but when I try to sum a column of 2 decimal place numbers the result always comes back as 0.  Can anyone help?

    Hi laura,
    I suspect that your 2 decimal place numbers are formatted as text. Change the format of the column to currency and see it that works.
    Also You might want to update your profile to reflect your current systems!
    quinn

  • Proper use of the sum function of Expression

    I want to get the sum of three number fields and use the value in a between function of ReportQuery as part of the selection criteria. I have tried a number of ways to do this, but can't seem to get it correct. Can some give me some code examples as to how to do this.
    Thanks,
    Jay

    You should be able to use the ExpressionMath.add() API to do this.
    i.e.
    Expression sum = ExpressionMath.add(ExpressionMath.add(eb.get("salary"), eb.get("raise")), eb.get("bonus"));

  • Sum() function not working properly. Instead of summing, its showing total count of the rows

    We have migrated one application from .net framework 1.0 to .net framework  2 (from Visual studio 2003 to Visual STUDIO 2005). Now after migration we are facing some problem related to the sum function in Crystal report 10. It is not working properly.
    So we migrated to Crystal report XI release 2 (though still using evaluation version for testing purpose), the problem is not yet resolved.
    The problem we are facing is while using the summary in the group field, it is showing the number of rows instead of the sum of the values.
    We have checked the same with min-max functions, and it is working properly with those.
    We have tried to make the sum by formula field. In such case, it is not showing any syntactical error but at execution time, it is throwing an error saying "A number field or currency amount field is required here".
    In the  the report the datatype of the field on which we are applying the sum function, is number, and in the table from where the data is fetched, the datatype is numeric(9,6).
    Any idea why sum function is not working ?
    I was browsing the net and saw running totals can be a work around for such summation issues in Crystal Report XI.
    Can you please provide insight of how to implement running totals for summation purpose in solving such issues.

    Hi,
    Running totals are more accurate than Summary Totals in Crystal.  Why? ...ask Crystal.  Anyway, just right click on Running Totals, create a new one, and enter you fields, etc. For group totals, it gives you a place to reset the totals for each group, etc.  Pretty self explainatory. 
    Jim

  • Sum function not working properly in Crystal XI. Its showing total count of the values

    We have migrated one application from .net framework 1.0 to .net framework  2 (from Visual studio 2003 to Visual STUDIO 2005). Now after migration we are facing some problem related to the sum function in Crystal report 10. It is not working properly.
    So we migrated to Crystal report XI release 2 (though still using evaluation version for testing purpose), the problem is not yet resolved.
    The problem we are facing is while using the summary in the group field, it is showing the number of rows instead of the sum of the values.
    We have checked the same with min-max functions, and it is working properly with those.
    We have tried to make the sum by formula field. In such case, it is not showing any syntactical error but at execution time, it is throwing an error saying "A number field or currency amount field is required here".
    In the  the report the datatype of the field on which we are applying the sum function, is number, and in the table from where the data is fetched, the datatype is numeric(9,6).
    Any idea why sum function is not working ?
    I was browsing the net and saw running totals can be a work around for such summation issues in Crystal Report XI.
    Can you please provide insight of how to implement running totals for summation purpose in solving such issues.

    Are you seeing this happen in the Crystal designer as well, outside of any .NET application?

  • Where do I find the SUM & MAX functions under update rule, TYPE: FORMULA

    Hi,
    If I am setting up an update routine
    TYPE: FORMULA
    where do I find the function SUM ?
    I need to take the sum of a particular key figure under certain condition with the statement:
    IF( <condition>, <result when true>, <result when false> )
    i.e.
    IF( field1 > field2, Sum of Field3, Sum of Field3 )
    I canu2019t seem to find the Sum function. I found +, -, / etc under Basic Functions. Even under all u201CAll functionsu201D, I only see u201Csummarizeu201D but not sum.
    --Also where do I find the MAX and MIN functions if I want to use them in FORMULAS?
    Thanks

    Hi......
    Its better you go for calculated keyfigure
    Check this link :
    http://help.sap.com/saphelp_nw04/helpdata/en/6f/56853c08c7aa11e10000000a11405a/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/EN/13/e072abaddb574284d22361f0b824bf/content.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/72f4a790-0201-0010-5b89-a42a32223ffc
    It may help you......
    Regards,
    Debjani......
    Edited by: Debjani  Mukherjee on Sep 28, 2008 6:17 AM
    Edited by: Debjani  Mukherjee on Sep 28, 2008 6:23 AM

  • How to get the sum in appropriate column without a red triangle appearing?

    Hello,
    In 'Numbers" - How do get columns to add (calculate) the sum in each decending column on an Expense Report.
    When I highlight the decending column the total appears on the far left of the screen.  When I drag the sum amount from there to the appropriate column a red triangle with an ! appears instead of the amount.
    Thanks for your immediate help.

    The red triangle is an Error triangle. Clicking it will display the error message and tell you what error has occurred. From your description, my assumption is that you dragged the SUM() function from the quick calculations at the lower left and dropped it intto a cell in the column being summed.
    If that's the case, this is likely the error message you would see:
    When you highlighted the 'decending column,' you likely selected all of the cells in that column, including the one into which you dropped the function.
    Instead, do one of the following. These assume the column you want to sum is column B.
    If you want the sum at the top of the column:
    Make sure the row you want the sum to appear in is a Header row.
    Enter this formula into any Header Row cell in column B:   =SUM(B)
    If you want the sum at the bottom of the column:
    Add a Footer row to the table. (Go Table (menu) > Footer Rows > 1).
    Enter this formula into the Footer Row cell in column B:   =SUM(B)
    SUM (and other functions) that expect a range of cells will interpret a cell reference entered using only the column letter (B) as meaning 'all of the non-header, non-footer cells in column B', and will exclude those cells in header or footer rows.
    Regards,
    Barry

  • Error when using SUM function in Excel template

    I am trying to use the XDO_METADATA to create a sum of a column from my XML data and I am getting the following error in the Template Viewer:
    [111412_104246459][][PROCEDURE] Log Level is changed to PROCEDURE
    [111412_104246553][oracle.xdo.common.xml.XSLTWrapper][ERROR] XSL error:
    Time: 0.125 sec.
    FO Formatting failed.
    <Line 317, Column 116>: XML-23029: (Error) FORG0001: invalid value for cast/constructor
    @Line 317 ==> <Cell Index="2" Style="R7C3" Field="XDO_?SUM_V_CR_MO_IDD1?"><xsl:value-of select="sum(.//G_CR_MST_D/V_CR_MO_IDD)"/>
    when I use:
    XDO_?SUM_V_CR_MO_IDD1?     <?sum(.//G_CR_MST_D/V_CR_MO_IDD)?>
    or
    [111412_104048508][][PROCEDURE] Log Level is changed to PROCEDURE
    [111412_104048554][oracle.xdo.common.xml.XSLTWrapper][ERROR] XSL error:
    Time: 0.078 sec.
    FO Formatting failed.
    <Line 317, Column 105>: XML-23029: (Error) FORG0001: invalid value for cast/constructor
    @Line 317 ==> <Cell Index="2" Style="R7C3" Field="XDO_?SUM_V_CR_MO_IDD1?"><xsl:value-of select="sum(.//V_CR_MO_IDD)"/>
    when I use:
    XDO_?SUM_V_CR_MO_IDD1?     <?sum(.//V_CR_MO_IDD)?>
    I believe the XSL to be correct because when I change it to a count it works and when I go into BI Publisher 11g and create the query in the data model and then create a summary from it, the summary is created.
    Can anyone help?

    I went back to basics and created reports (via EXCEL templates) like I was asking based on good old EMP and DEPT and I found exactly the same problems I was mentioning. I looked at the templates provided but they were not calculating totals, like me they were selecting them and then just displaying them on the page.
    Anyway, I have narrowed it down to the fact that when you do aggregates like sum(.//SAL) this works if you have a salary for every value. I did an outer join with DEPT so I did have empty rows and why I still experienced the problems.
    Basically XSL does not like adding (including using the sum function) values that effectively have nulls in them which is why I get the cast/constructor errors because it is trying to turn a NaN value to a number and does not (or cannot) do it.
    You need to either have a value in every row of your column (maybe possible by selecting nvl in your query) and make sure that you check the "create empty nodes" checkbox in the data model of BI Publisher.,
    the other solution is an xsl solution where you would have to make sure that you only added non null values and for that you would have to investigate xsl blogs.
    It is, by the way, why my count worked because it is just counting that the record exists it does not care what the element content is or isn't.
    Closing thread.

  • Strange error in SUM function in XI

    Hi geeks,
    We are encountering a strange issue in SUM functionality in XI.
    The Scenario is :
    We have a pipe delimited source file and INVOIC01 idoc as target.  each line in the source file will create a segment E1EDP01 in the target IDOC.
    All the values given in the file should be summed and mapped to E1EDS01 segment in the idoc.
    In one such strange case the sum of the values generated by the SUM function in XI is 2 cents lesser what we manually calculate using Calculator or Excel . There are about 100+ items in the file.  This not the case always it happens once in a while.
    Have any of you faced such strange errors. If yes please throw some light on the solution for this issue.
    Thanks,
    Noorul

    Hi folks,
    Thanks for your help. I solved this by writing my own code
    double sum = 0;
    String value;
    for (int i= 0; i< a.length; i++)
    sum = sum + Double.parseDouble(a<i>);
    value = Double.toString(sum);
    BigDecimal  bg1 = new BigDecimal(value);
    BigDecimal bg2 = bg1.setScale(2, BigDecimal.ROUND_HALF_DOWN);
    result.addValue(bg2.toString());

  • Problem with the "Wait" function in dialing a number with an extension.

    I inserted a "wait" into phone number, followed by an extension. When I tap the number, it dials the call. Next to the "End" button, there is a button that shows "Dial..." and the extension. HOWEVER, the next calls for other numbers will always show the same "Dial..." and the extension until IOS restart. Any solution?

    Hello,
    Plese see below the correct syntax for the SUM function
    The following examples are applicable to both Basic and Crystal syntax:
    Sum({file.QTY})
    Calculates the sum of all values in the QTY field.
    Sum({orders.AMOUNT}, {orders.CUSTOMER ID})
    Sums (totals) the orders in each group of orders in the Amount field. The orders are separated into groups whenever the value in the Customer ID field changes.
    Sum({orders.AMOUNT}, {orders.DATE}, "monthly") % Sum({orders.AMOUNT })
    Groups values in the Amount field by month, and calculates the sum of the values for each month group as a percentage of the sum of the values for the entire report.
    Sum([{file.AMOUNT}, {file.PRICE}, {file.COST}])
    Sum of values in the Amount, Price, and Cost fields.

  • How to correct XML Output in Cross Tab Template for sum function?

    I have designed a Cross Tab Template to summarize R12 Account Analysis data by Period by Party_name. The template is doing what I want it to do with the exception of amount. I have a function in the sum(accounted_net) field and it will only display 0.00 even though I know there are actual amount. Can someone help in looking at my template to see what I have done wrong?
    Here is the sum funciton.
    <?if:count(current-group()[CCID_SOURCE=$ABC])?><?sum(current-group()[CCID_SOURCE=$ABC]/ACCOUNTED_NET)?> <?end if?>
    CCID_SOURCE is an element I created in XML to concatnate CCID and Party_name for grouping. $ABC is a variable that I defined for "CCID_SOURCE" to check if there is null value for a specific ccid_party. If it's null, it won't do the sum function, otherwise it will sum the accounted_net for the period_name, party_name.
    Thank you for your help.
    Stacey

    Figured this out on our own

  • Problem with group by and sum function

    In one of the report I'm using grioup by clause on one column. However when I use this function the sum function on other column is not working.
    Any idea how we can resolve this?

    Hi Tintin,
    Follow the below steps:
    1) On the order number column formula, use the max function.
    2) Duplicate the revenue column in the RPD, set the aggregation to sum and level to transaction. This will give you the sum of all the orders in a particular trasaction, where as in report you will see only the max account number.
    Assign points if helpful.
    Thanks,
    -Amith.

Maybe you are looking for

  • How to Add parameter fields in BI publisher fields

    Hi, I'm creating xml report for Apps standard Trial Balance Summary, here i cant able to run the .rdf locally due to SRW.UserExit . So i got the XML file from output of the report. Then i added the xml data in BI publisher and then i have created the

  • Where is the "search more" option in Gmail?

    Currently using: Lumia 920 white - Windows Phone 8 I had a Lumia 800 before and when opening my email and searching for something, if it did not come up I could use the "search more" option and It would search in all my email. (not synced) It looks l

  • Video from itune

    i cant transfer my video from my itune library to my ipod. what should i do to make it work?

  • Change tracking in Web Tab

    Hi All, How to get the change tracking in Web Tab of Data Manager. Regards, Nikhil

  • Form 24Q Errror: T-FV-2133 For Form 24Q quarter Q4, SD is mandatory, so count of salary statement

    Hi All, For the Tcode PC00_M40_F24Q when it is executed for the Quater 4, We are getting the below error when we are trying to validate the efile: "T-FV-2133 For Form 24Q quarter Q4, SD is mandatory, so count of salary statement records must be great