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.

Similar Messages

  • I am getting this error :The right function requires 2 argument(s).

    declare 
    @startdate datetime,
    @enddate datetime 
    SET @STARTDATE ='01-MAR-2014'
    SET @enddate = '01-MAR-2014'
    Set @StartDate = Convert(datetime, Convert(char(10), @StartDate, 120) + ' 00:00:00', 120)
    set @enddate =convert(datetime,Convert(char(10),@enddate, 120) + ' 23:59:59',120) 
    SELECT 
    [row_date]
    ,[logid]
    ,CONVERT(VARCHAR(6), (ISNULL(SUM([acwouttime] + [auxouttime] + [holdtime]), 0))/3600) + 
    ':' + RIGHT('0' + CONVERT(varchar(2),(ISNULL(SUM([acwouttime] + [auxouttime] + [holdtime]), 0)) % 3600) / 60), 2)
    + ':' + RIGHT('0' + CONVERT(varchar(2), (ISNULL(SUM([acwouttime] + [auxouttime] + [holdtime]), 0)) % 60), 2)AS HoldTime
    FROM [CMSData].[dbo].[hagent2]
    WHERE ([logid] IN (1382, 1493,1382,1493,1444,1466,1301,1074,1655,
    1749,1685,1686,1684,1617,1681,1792,1595,1597,1687,1622))
    AND (row_date BETWEEN  @StartDate AND @EndDate)
    GROUP BY 
    [row_date]
    ,[logid]
    hi friends when I am executing this query I am getting this error please help me I will grateful to you .
    ERROR: The right function requires 2 argument(s).

    you may be better off making date filter as below
    declare
    @startdate datetime,
    @enddate datetime
    SET @STARTDATE ='01-MAR-2014'
    SET @enddate = '02-MAR-2014'
    AND (row_date >= @StartDate AND row_date <@EndDate)
    see
    http://visakhm.blogspot.in/2012/12/different-ways-to-implement-date-range.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • 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)

  • 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

  • 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

  • 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

  • What kind of input parameter is used in SUM function?

    Hi Everyone,
    As we know sum is a predefined oracle function. But what these oracle guys have used for the input parameters. How they have done this?
    I mean we can write this sum fuction like so many ways like as mentioned below. Please give me some ideas how to do that.
    SELECT SUM(salary) as "Total Salary" FROM employees;
    SELECT SUM(DISTINCT salary) as "Total Salary" FROM employees;
    SELECT SUM(income - expenses) as "Net Income" FROM gl_transactions;
    SELECT SUM(sales * 0.10) as "Commission" FROM order_details;Regards,
    BS2012

    BS2012 wrote:
    Hi Everyone,
    As we know sum is a predefined oracle function. But what these oracle guys have used for the input parameters. How they have done this?
    I mean we can write this sum fuction like so many ways like as mentioned below. Please give me some ideas how to do that.
    SELECT SUM(salary) as "Total Salary" FROM employees;
    SELECT SUM(DISTINCT salary) as "Total Salary" FROM employees;
    SELECT SUM(income - expenses) as "Net Income" FROM gl_transactions;
    SELECT SUM(sales * 0.10) as "Commission" FROM order_details;Regards,
    BS2012As others have said, your question is not quite clear.
    There are many aspects and angles to looking at what you are asking.
    Primarily, from a top-level, the sum function simply takes a number value as it's argument, so all those examples you have given have expressions in them that evaluate to a numeric value before being supplied to the sum function. (As someone else already mentioned you can have non-numeric datatypes, just so long as they can implicitly be converted to a numeric value).
    From a statement parsing and execution perspective, the contents of the expression inside the brackets will be evaluated before being passed to the sum function. It is not the sum function that itself takes the expression and evaluates it. The sum function just expects a single numeric value.
    Internally, what the sum function does, is more than just a single... call function and return value, because it has to deal with multiple values being passed in as part of the aggregating group. As such, it needs to have the ability to know when to start it's summing, to accept multiple values as input so it can sum them together, and to know when to stop summing inputs and pass the result back.
    If we write our own user defined aggregate function (other people have already provided a link to explain such) we can see what is happening internally. In this following example, we'll write a user defined function that multiplies the values rather than sums them...
    create or replace type mul_type as object(
      val number,
      static function ODCIAggregateInitialize(sctx in out mul_type) return number,
      member function ODCIAggregateIterate(self in out mul_type, value in number) return number,
      member function ODCIAggregateTerminate(self in mul_type, returnvalue out number, flags in number) return number,
      member function ODCIAggregateMerge(self in out mul_type, ctx2 in mul_type) return number
    create or replace type body mul_type is
      static function ODCIAggregateInitialize(sctx in out mul_type) return number is
      begin
        sctx := mul_type(null);
        return ODCIConst.Success;
      end;
      member function ODCIAggregateIterate(self in out mul_type, value in number) return number is
      begin
        self.val := nvl(self.val,1) * value;
        return ODCIConst.Success;
      end;
      member function ODCIAggregateTerminate(self in mul_type, returnvalue out number, flags in number) return number is
      begin
        returnValue := self.val;
        return ODCIConst.Success;
      end;
      member function ODCIAggregateMerge(self in out mul_type, ctx2 in mul_type) return number is
      begin
        self.val := self.val * ctx2.val;
        return ODCIConst.Success;
      end;
    end;
    create or replace function mul(input number) return number deterministic parallel_enable aggregate using mul_type;
    /So, our user defined aggregate function is based on an aggregate object type.
    This object holds a value ("val" in our example).
    It has an Initialize method, so when the SQL engine indicates that it's the start of an aggregation of values it can set it's value to an initial value (in this case null).
    It has an Iterate method, so as the SQL engine passes values to it as part of the aggregated set of values, it can process them (in our case it multiplies the input value with the value it already has for this set of aggregations (and takes a base value of 1 for the first iteration))
    It has a Terminate method, so when the SQL engine indicates that the aggregate set of values is complete, it can return the result.
    The last method in there is a Merge and is a mandatory requirement, so that when aggregation is done using parallel evaluation (to improve performance internally), the results of those parallelly executed aggregations can be combined together (see http://docs.oracle.com/cd/E11882_01/appdev.112/e10765/ext_agg_ref.htm#ADDCI5132). As we're multiplying numbers, in our case, it is simply a case of multiplying one result with the other.
    And to see it working...
    SQL> with t as (select 2 as x from dual union all
      2             select 3 from dual union all
      3             select 4 from dual union all
      4             select 5 from dual)
      5  --
      6  select mul(x)
      7  from t;
        MUL(X)
           120

  • SUM function resulting WRONG values when some cell contains a string

    A very strange problem that can result in wrong financial calculations and big mistakes...
    If we have SUM function for some range of cells and one of them is treated as text string (I mean it's number in fact but Number is sure it's text string). than SUM function calulates ALL cells except this sell silently without errors and results in wrong result.
    For example we have cells and values
    A B
    =====
    1| 15 USD
    2| 0 USD
    3| 37 USD
    4| 1 USD
    5| 3 USD
    here the function SUM(B1:B5) should provide the result "56 USD"
    But if cell B5 is treated as text string (it can be still displayed as "3 USD" so we don't know it's treated as text string for some reason) than SUM(B1:B5) swill answer "53 USD".
    The problem is we DON'T know cell B5 is treated as text and we are fully sure that we have the correct sum of all 5 cells, in reality we see sum of 4 cells only....
    I think anybody working with financial or other important data can imagine how dangerous this SUM behaviour is.... I encountered several times that when importing data from Excel or by other ways numbers are imported as text strings. So if I have a lot of cells I'm not sure if all those cells are correctly styled or some of them for some unknown reason is treated as text string.
    In Microsoft Excel there is a very right solution. In MS Excel if any cell in the SUM is wrong format the SUM function simply provides error as a result. But in Numbers SUM doesn't tell us about error, it simply provides us with a wrong result!
    With formal logic the way SUM works in Numbers is total idiotism. If I ask to SUM B1:B5 than I definitely ask to sum ALL 5 cells, not 4, not 3, not 6 but 5 definite cells. If Numbers can't sum those exactly those 5 cells the only answer of the function should be ERROR.
    But Apple Numbers answers me some result of summing those cells that it's able to sum. Apple Numbers SUM function is not confused that I asked for SUM of 5 (not 4 or 3) cells and I expect to have this sum as a result.
    In fact Apple uses the right logic when we use another formula. If we use =B1B2+B3+B4B5 and any cell contains text string that we'll have error result the sam as in Microsoft Excel. So in this example Numbers behaves correctly.
    So why SUM (B1:B5) can provide totally different result as =B1B2+B3+B4B5?

    alexb2 wrote:
    So when I set format for my number as my local currency it's displayed as 123 XXX (XXX is my currency but it's not in latin). I see it's not only displayed but also stored as 123 XXX. That's different from Excel that stores only numbers in cells and shows number with prefix or suffix - Numbers storex number with prefix or suffix.
    No, you get this behavior because the original sheet is displaying values as currencies. I assumes that the import process pass it as a string because he doesn't recognize it as a currency value. As far as I know, Numbers stores the currency entries as a pure number and an indicator of the used currency.
    Here is an example.
    (a) the description of the numerical value (I underlined it: 456)
    <sf:number-cell sf:flags="4" sf:value="456" sf:col="1" sf:row="2">
    <sf:cell-style-ref sfa:IDREF="SFTCellStyle-46"/>
    <sf:content-size sfa:w="58.659881591796875" sfa:h="14"/>
    </sf:number-cell>
    (b) the description of the format (I underlined the used currency: XAM)
    <sf:cell-style sfa:ID="SFTCellStyle-46" sf:cell-style-default-line-height="12" sf:parent-ident="tabular-Basic-body-cell-style-id">
    <sf:property-map>
    <sf:SFTCellStylePropertyNumberFormat>
    <sf:number-format sfa:ID="SFTNumberFormat-23" sf:format-type="1" sf:format-string="#,##0.00 &#xA4;;-#,##0.00 &#xA4;" sf:format-decimal-places="2" sf:format-currency-code="XAM" sf:format-negative-style="0" sf:format-show-thousands-separator="true" sf:format-fraction-accuracy="-3" sf:format-use-accounting-style="false"/>
    </sf:SFTCellStylePropertyNumberFormat>
    <sf:SFTCellStylePropertyImplicitFormatType>
    <sf:number sfa:number="256" sfa:type="i"/>
    </sf:SFTCellStylePropertyImplicitFormatType>
    <sf:SFTCellStylePropertyFormatType>
    <sf:number sfa:number="257" sfa:type="i"/>
    </sf:SFTCellStylePropertyFormatType>
    </sf:property-map>
    </sf:cell-style>
    Of course, if the original currency string is not recognized, it can't be described as such a feature and the value is treated as a simple string.
    So may be at some moment my 123 XXX is treated like string value.
    Yes, find and replace is a nice tool when importing data - thanks for the tip. the last problem is with already Numbers files that were imported not today (or even createde as Numbers file) where some cell becomes string value after some editing.
    Here again, if you edit a currency string and replace it to a not recognized one, the result will be logically a string.
    There is an other way to give this result:
    copy a value from a cell formatted as XAM currency (just an example)
    paste it in a cell whose format is currency Euro (once again it's just an example).
    The result will be a string.
    The culprit is not the program, it's the user.
    I had several times this situation and last time I found error only because I have my budget in 2 programs - in Numbers and in another special budgeting program. As each program has advantages I have in fact 2 instances of the same budget.
    And when I changed some string in Numbers and another program I noticed the sum is different. I was sure it's another program somewhere buggy but noticed than Numbers simply ignores one of the budget strings and sums without it... In fact it was even not the string I changed, I remember I changed the buggy string about a week ago but I haven't compared budgets that time so my budget had a mistake for some time till I noticed it. If I used only Numbers without copy of budget in another program may be even today I won't notice the mistake.
    The same situation happened not once.
    I think that the choice made by Apple for SUM() is correct. You feel that it is wrong. It's useless to debate more, we will not change the behavior of the function.
    I try to give a workaround.
    The neater one is to add columns as I described in my first response.
    The given formula will clearly flag cells which aren't containing numerical values. If you move the SUM from the original range to the new one, the oddities will be flagged automatically.
    Here is an alternate workaround:
    The currency is XAM.
    In B4 I introduced a typo so the value is no longer a numerical one.
    Given that, the sum in the footer doesn't count the 34 (which is the normal behavior).
    In column C1 I entered =1*B
    which flagged the bad cell.
    The alternate is to use an auxiliary table like aux1
    In A1 I entered:
    =IF(ISERROR(INDIRECT(ADDRESS(ROW(),COLUMN(),,,"main"))),"",IF(ISBLANK(INDIRECT(A DDRESS(ROW(),COLUMN(),,,"main"))),"",1*INDIRECT(ADDRESS(ROW(),COLUMN(),,,"main") )))
    Exactly the same formula in B1, C1, D1, …
    So, the table will automatically grab the contents of the main table (just take care to insert more columns in aux1 than in main)
    In the footer row of aux1, insert a sum formula for columns where there is required.
    Looking at this footer will flag columns where a value may be "wrong" so, it will be necessary (but easy) to scan the column's content to find the red triangle(s).
    Yvan KOENIG (from FRANCE lundi 13 octobre 2008 13:27:40)

  • 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());

Maybe you are looking for

  • Y do I get a quicktime failed to initialize error when i try to download itunes?

    Why do I get an error message saying quicktime failed to initialize when downloading i-tunes?

  • Windows Photo Gallery Warning - Not enough memory

    I am currently going through holiday pictures and deleting a fair few. I have folders that consist of around 1500 pictures, which includes both jpegs and NEFs. When I view these I have no problem for the first say 50 or even 100 at times. Eventually

  • How can i print a list of a folder contents?

    On previous systems i used to be able to print a complete list of everything in a praticular folder. Very useful for comparing contents or logging contents before backing up and or re-installing. With Tiger i don't seem to be able to do this form the

  • Changes in existing ARFC Model

    Hello experts.. I m working on existing build Java web dynpro application .... In reporting modules .. i have to generate a new report ... already 3 reports are generated using models thru ARFC .... Now i need to import one more model for new report

  • Photoshop CS5 crashing when making .pdfs

    It's been happening right after I've scanned something. Reboots aren't working well, either. On Windows 7... Here's the message I get: Problem Event Name: APPCRASH Application Name: Photoshop.exe Application Version: 12.0.3.0 Application Timestamp: 4