Incorrect sum function result in invoice

I'm a Numbers noob, so apologies if this has been covered elsewhere, but I couldn't find it.This issue causes me no issues in Excel but doesn't work properly in Numbers, so I'm wondering what gives.
I have an invoice for my clients where I have multiple rows, each with a service item, followed by the number of hours spent on that, followed by a cell with an EQUAL function, ie 2/3 of an hour x $40 per hour, which correctly EQUALs as $26.66. (The EQUAL cell is set to formatted as currency to 2 decimal places)
If a second item appears that has say 1/3 of an hour x $40 per hour, this correctly EQUALs as $13.33.
However when I total the EQUALs column with a SUM function, it shows $40, not $39.99. As the cells are only formatted to 2 decimal points, and all are formatted as currency, where could the error be happening?
My clients accounting dept keeps coming back and complaining about my invoices being incorrect... I can't believe that Numbers can't do a SUM function.

Hi Fritz,
1/3 and 2/3 are not exact numbers. They go to infinity.
Column B is formatted as Fraction
Column C is formatted as Number (Decimals Auto)
Formula in C2 (and Fill Down)
=B2
Formula in D2 (and Fill Down)
=C2×40
The Numbers app is correctly rounding to two decimal places.
If you display Column C as Number to 2 decimal places,
Again, correct.
Your clients are quibbling about $0.0000000000000000000 (to infinity) then a infinitesimal part of 1 cent. Which is nonsense!
Shops also round the total invoice up or down.
If you work an extra 10 minutes, that will equal exactly 0.5 hours.
If you work 5 minutes less, that will equal exactly 0.25 hours.
No rounding needed, and no argument from your clients!
Regards,
Ian.

Similar Messages

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

  • Oracle 11g SUM function on the result of inner Select

    The inner Select returns rows with the values. The outer select running on tthe result of inner select SUM the result of the inner select.
    Although there are valid rows of the inner select the SUM in the outer SELECT return NVL. As a comment any aggregate function on the outer select returns NVL.
    The query is below.
    select a.yil,
    a.ay,
    sum(brut_prim),
    sum(kom),
    from (SELECT oid_pol_kesilen_acente,
    to_char(pp.zeyil_tanzim_tar, 'yyyy') yil,
    to_char(pp.zeyil_tanzim_tar, 'mm') ay,
    sum(decode(substr(pp.no, 1, 1),
    'T',
    pp.zeyil_brut_prim_fark / 2,
    pp.zeyil_brut_prim_fark)) -
    sum(pp.zeyil_gv_fark) brut_prim,
    sum(pp.zeyil_acente_kom_fark) kom
    from pol_police pp, org_acente oa
    WHERE SUBSTR(PP.NO, 1, 1) != 'D')
    group by oid_pol_kesilen_acente,
    to_char(pp.zeyil_tanzim_tar, 'yyyy'),
    to_char(pp.zeyil_tanzim_tar, 'mm')) a
    group by a.yil, a.ay, oid_pol_kesilen_acente
    Edited by: [email protected] on May 7, 2010 2:09 AM
    Edited by: [email protected] on May 7, 2010 2:31 AM

    Hi,
    please try the below sql:
    select a.yil, a.ay, sum(brut_prim), sum(kom),
    from (SELECT oid_pol_kesilen_acente,to_char(pp.zeyil_tanzim_tar, 'yyyy') yil, to_char(pp.zeyil_tanzim_tar, 'mm') ay,
    sum(decode(substr(pp.no, 1, 1), 'T',nvl(pp.zeyil_brut_prim_fark,0) / 2,nvl(pp.zeyil_brut_prim_fark,0))) - sum(nvl(pp.zeyil_gv_fark,0)) brut_prim,
    sum(nvl(pp.zeyil_acente_kom_fark,0)) kom
    from pol_police pp, org_acente oa
    WHERE SUBSTR(PP.NO, 1, 1) != 'D'
    group by oid_pol_kesilen_acente,
    to_char(pp.zeyil_tanzim_tar, 'yyyy'),
    to_char(pp.zeyil_tanzim_tar, 'mm')
    ) a
    group by a.yil, a.ay, oid_pol_kesilen_acente ;
    Thanks,
    Siva

  • SUM function to give NULL result

    I am really lost on how I can force the SUM function to give me a NULL result when at least one of the elements is a NULL value. I would appreciate any help.

    The short answer is "you can't". The slightly longer answer is the you can't because most aggregate functions work only on non-null values, so SUM silently ignores NULLS.
    However, you can take advantage of that fact to do what you want.
    SQL> SELECT * FROM t;
            ID GROUPCOL
            33 GROUPA
            50 GROUPA
             5 GROUPA
            21 GROUPA
            43 GROUPA
            58 GROUPB
            10 GROUPB
            29 GROUPB
            10 GROUPB
            37 GROUPB
               GROUPA
    SQL> SELECT groupcol, SUM(id) sum_id, COUNT(*) count_all,
      2               COUNT(id) count_id
      3        FROM t
      4        GROUP BY groupcol;
    GROUPCOL       SUM_ID  COUNT_ALL   COUNT_ID
    GROUPA            152          6          5
    GROUPB            144          5          5Note that count_all is different than count_id. So, we can wrap this query in another to return NULL for the sum of groupa.
    SQL> SELECT groupcol, CASE WHEN count_all = count_id THEN sum_id
      2                        ELSE NULL END sum_id
      3  FROM (SELECT groupcol, SUM(id) sum_id, COUNT(*) count_all,
      4               COUNT(id) count_id
      5        FROM t
      6        GROUP BY groupcol);
    GROUPCOL       SUM_ID
    GROUPA
    GROUPB            144Although, I too would be interested in the answer to 405764's question.
    John

  • Issues using SUM Function in query

    I have pasted two queries Query1 (calculating counts for total_ships and ships_released) and Query2 (calculating the two same counts and then calculating SUM for total_shipments and I am having problem in this)
    Query 1:
    select  b.loc , b.week, b.vvalue2, b.Total_ships, nvl(a.up_date,'None') as datee , nvl( a.ships_rel_total,0) as Total_released
    from (
          SELECT l.loc  , sr1.vvalue1 as Week, sr.vvalue2 , to_char(ss.udate, 'YYYY-MM-DD') as up_date ,  count(distinct s.ship_id ) as ships_rel_total
          FROM ship s, loct l,
             ship_num sr1,  ship_num sr, ship_stat ss, ship_stat ss1
          WHERE ......
          Group by l.loc , sr1.vvalue1, sr.vvalue2 , to_char(ss.udate, 'YYYY-MM-DD')
          ) A,
    ( SELECT distinct l.loc  , sr1.vvalue1 as Week, sr.vvalue2 , count(s.ship_id ) as Total_Ships
          FROM ship s, loct l,
              ship_num sr1,  ship_num sr, ship_stat ss, ship_stat ss1
          WHERE ......
          Group by c.loc , c.week , c.vvalue2  ) B
    where a.loc (+) = b.loc
    and a.vvalue2  (+) = b.vvalue2
    order by b.loc, b.week , b.vvalue2,a.up_date; Query 1 Output:
    *OUTPUT*
    LOC         WEEK          VALUE2        TOTAL_SHIPS       DATEE         TOtAL_SHIPS_RELEASED
    AA          111              BB              12                  10-05-12            2
    AA          111              BB              12                  11-05-12            4
    AA          111              CC              2                    14-05-12            1Then I added sum function for total_ships and its not giving me result what I need :(
    Query 2:
    select  b.loc , b.week, b.vvalue2, b.sum_ships, nvl(a.up_date,'None') as datee , nvl( a.ships_rel_total,0) as Total_released
    from (
          SELECT l.loc  , sr1.vvalue1 as Week, sr.vvalue2 , to_char(ss.udate, 'YYYY-MM-DD') as up_date ,  count(distinct s.ship_id ) as ships_rel_total
          FROM ship s, loct l,
             ship_num sr1,  ship_num sr, ship_stat ss, ship_stat ss1
          WHERE ......
          Group by l.loc , sr1.vvalue1, sr.vvalue2 , to_char(ss.udate, 'YYYY-MM-DD')
    ) A,
    ( Select  c.loc, c.week , c.vvalue2 ,  sum(c.total_ships) sum_ships 
    from
        ( SELECT distinct l.loc  , sr1.vvalue1 as Week, sr.vvalue2 , count(s.ship_id ) as Total_Ships
          FROM ship s, loct l,
              ship_num sr1,  ship_num sr, ship_stat ss, ship_stat ss1
          WHERE ......
          Group by l.loc , sr1.vvalue1 , sr.vvalue2  ) C
    Group by c.loc , c.week , c.vvalue2  ) B
    where a.loc (+) = b.loc
    and a.vvalue2  (+) = b.vvalue2
    order by b.loc, b.week , b.vvalue2,a.up_date;  my query is giving me this :(
    Query 2 Output:
    LOC         WEEK          VALUE2        *SUM_SHIPS*       DATEE         TOtAL_SHIPS_RELEASED
    AA          111                BB              26                 10-05-12            2
    AA          111                BB              26                 11-05-12            4
    AA          111                CC              26                 14-05-12            1
    But I need a result like this:
    LOC         WEEK          VALUE2        SUM_SHIPS       DATEE         TOtAL_SHIPS_RELEASED
    AA          111                BB              14              10-05-12            2
    AA          111                BB              14              11-05-12            4
    AA          111                CC              14              14-05-12            1

    Hi,
    It sounds like you have a Fan Trap , where a one-to-many relationship is causing some items to be counted many times.
    The usual solution is to compute the aggregates before doing the one-to-many join. Analytic functions may make this simpler.
    Sorry, I can't show you exactly how to do it without the exact data.
    Post CREATE TABLE and INSERT statements for all tables involved, and also post the results you want from that data (if different from what you've already posted).
    Explain, using specific examples, how you get those results from that data.
    Simplify the problem as much as possible. If the problem only concerns the total_ships column, then only post the data needed to compute total_ships. This includes all the columns involved in the joins and GROUP BY clauses.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

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

  • PDF Download doesn't keep an aggregate function result

    Hello,
    I have an interactive report that has a sum that I created using the aggregate function. When I download to a PDF, there is no sum.
    Does anyone have a solution?
    Thanks,
    Matt

    Hi Matt
    At this time the Interactive Report Regions (IRR) don't support this functionality. I'm assuming that's what you're kicking-off the PDF generation from.
    The only solution I am aware of is to set up an APEX Report & Template that contains the SUM function you require displayed in your PDF. Whilst this will deliver the result you're after, you will lose the flexibility of the IRR.
    You may also want to add your comments/thoughts to this thread I started earlier.
    [http://tinyurl.com/peu6b2]
    If you need help with the APEX Report & Template option, please let me know.
    Kind regards
    Simon Gadd

  • Function result as an item for another function.

    I have a report that has a field A(number) which is the result of a custom function. My next field B needs to sum up all these results i.e. sum of field A grouped by certain field. Another field C needs to divide field B by a calculated number etc.
    Because I can't choose function result as an Item, I'd have to recalculate for field B, and again for field C etc, which degrades performance.
    Any ideas on how to tackle this problem?

    Dear Peter,
    Does this amount appear as an amount in your GL and missing in your Asset Accounts, or vice versa.
    Please, do check if there are any manual postings performed from FI, not from the depreciation program.
    They will disappear from ABST2 when you reverse them from FI.
    KR
    Severina
    Edited by: Severina Koleva on Feb 22, 2010 3:55 PM

  • SUM function issue

    Hi everyone,
    I have a problem with SUM function in SQL query on Oracle 11g database. Maybe you will be able to help me.
    Problem:
    I want to shows summary costs for shipments separately for each service provider and for each month they did the shipments.
    Data is stored in SHIPMENT AND SHIPMENT_COST table as shown below. The problem is that summary function I use sums base costs (marked as B in SHIPMENT_COST table) for each accessorial cost (marked as A in SHIPMENT_COST table). In example for shipment 10005031 we have 4 accessorial costs so it shows 6120 in BASE_COST column. I tried to use distinct in summary but then we have a problem with shipment id 201307133713_0383 which has 3 base costs equal to 221.54 so with distinct it will show 221.54 instead of 221.54x3.
    SHIPMENT table:
    START_TIME               SHIPMENT_GID               SERVPROV_GID
    2013-06-25                    10005031                         T222176
    2013-06-15                    201307133713_0383          T76180
    SHIPMENT_COST table:
    SHIPMENT_GID                        COST                                       COST_TYPE
    10005031                                 1530                                        B
    10005031                                  30.6                                        A
    10005031                                  120                                         A
    10005031                                  400                                         A
    10005031                                  100                                         A
    201307133713_0383                   221.54                                    B
    201307133713_0383                   221.54                                    B
    201307133713_0383                   221.54                                    B
    RESULT table:
    SHIPMENT_START_DATE
    SERVPROV
    BASE_COST
    CLAIM_COST
    06/2013
    T76180
    664.62
    null
    06/2013
    T222176
    6120
    650.6
    Query:
    SELECT DISTINCT TO_CHAR(SH.START_TIME,'MM/YYYY') AS SHIPMENT_START_DATE,
            SH.SERVPROV_GID AS SERVPROV,
            SUM(SHCOST.COST) AS BASE_COST,
            SUM(SHCOST_CLAIM.COST) AS CLAIM_COST
    FROM    SHIPMENT SH,
            SHIPMENT SHC
            LEFT OUTER JOIN SHIPMENT_COST SHCOST ON (SHC.SHIPMENT_GID = SHCOST.SHIPMENT_GID AND SHCOST.COST_TYPE = 'B'),
            SHIPMENT SHC_CLAIM
            LEFT OUTER JOIN SHIPMENT_COST SHCOST_CLAIM ON (SHC_CLAIM.SHIPMENT_GID = SHCOST_CLAIM.SHIPMENT_GID AND SHCOST_CLAIM.COST_TYPE = 'A')
    WHERE 1=1
            AND SHC.SHIPMENT_GID = SH.SHIPMENT_GID
            AND SHC_CLAIM.SHIPMENT_GID = SH.SHIPMENT_GID
            AND    SH.SHIPMENT_GID IN ('10005031','201307133713_0383')
            GROUP BY TO_CHAR(SH.START_TIME,'MM/YYYY'),
            SH.SERVPROV_GID
    Best Regards,
    Łukasz

    with SHIPMENT (START_TIME,SHIPMENT_GID,SERVPROV_GID) as
    select to_date('2013-06-25','yyyy-mm-dd'),'10005031','T222176' from dual union all
    select to_date('2013-06-15','yyyy-mm-dd'),'201307133713_0383','T76180' from dual
    SHIPMENT_COST(SHIPMENT_GID,COST,COST_TYPE)
    as
    select '10005031','1530','B' from dual union all
    select '10005031','30.6','A' from dual union all
    select '10005031','120','A' from dual union all
    select '10005031','400','A' from dual union all
    select '10005031','100','A' from dual union all
    select '201307133713_0383','221.54','B' from dual union all
    select '201307133713_0383','221.54','B' from dual union all
    select '201307133713_0383','221.54','B' from dual
    select *
      from (select to_char(t.START_TIME, 'mm/yyyy'),
                   t.SERVPROV_GID,
                   c.COST,
                   c.COST_TYPE
              from SHIPMENT t
              join SHIPMENT_COST c
                on t.SHIPMENT_GID = c.SHIPMENT_GID)
    pivot(sum(COST) for COST_TYPE in('A' CLAIM_COST,'B' BASE_COST))
    TO_CHAR(T.START_TIME,'MM/YYYY'
    SERVPROV_GID
    CLAIM_COST
    BASE_COST
    06/2013
    T76180
    664.62
    06/2013
    T222176
    650.6
    1530
    Ramin Hashimzade

  • Help with SUM function ??

    Hi,
    I am trying to build a SUM function into the following SELECT statement;
    SELECT   emp_code "EmployeeCode", trn_date "TransactionDate", project "ProjectCode",
    phase_code "PhaseCode", task_code "TaskCode", reg_hrs "RegularHoursAmt", rate_reg "RegularHoursRate", ot_hrs "OvertimeHoursAmt", rate_ot "OvertimeHoursRate"
    Currently when i do the extract to xls I manually compile the "RegularHoursAmt" and "RegularHoursRate" manually and it's quite a task. I'm sure it can be completed in teh SELECT but I'm not clear on how and it's been quite some time since my last foray into SQL. Any assistance appreciated.
    I need to sum "RegularHoursAmt" and "RegularHoursRate"
    per "EmployeeCode"
    by "TransactionDate"
    with unique combo of "ProjectCode", "PhaseCode", "TaskCode"
    Cheers, Peter

    Hi, Peter,
    PJS5 wrote:
    Thanks Frank for the quick response. Ok, here goes;
    The TABLES already exist and I am only pulling the data for the columns in my SELECT statement so no CREATE of INSERT as such.Post CREATE TABLE and INSERT statements so that the people who want to help you can re-create the problem and test their ideas.
    The data is in Oracle 10g 10.1.0.2.0Perfect!
    So you want totals that represent the entire day for a given employee.
    Yes, but rows are by the unique combo per employee of "ProjectCode", "PhaseCode", "TaskCode"So a row of output will represent a distinct combination of employee, day, ProjectCode, PhaseCode and TaskCode, and that one output row may correspond to more than one row of input; is that right?
    eg Tom works on 4 unique "ProjectCode/PhaseCode/TaskCode" efforts on "TransactionDate"What does "effort" mean here? If I could look at some actaul data (or actual fake data; don't post anything like real credit card numbers) and the results you want from that data, perhaps it would be clear.
    One of those unique "ProjectCode/PhaseCode/TaskCode" efforts however has 3 timesheet entries as he has added unique Descriptions of what his efforts were aimed at achieving.
    We are not extracting the Descriptions and thereby want to SUM those 3 timesheet entries into one row.
    Do you also want a total for each employee, over all days? No thanks
    Do you want a grand total for all employees and all days? No thanks
    Do you want the totals on the same output rows as your current reuslts? That would be handy
    If so, use the analytic SUM function. I'm not familiar with this
    Do you want separate rows for the the totals? That could helpPost the exact results you want from a small set of given data. It's fine to describe the results, as you did above, but describe them in addition to (not instead of) actually showing them.
    Does that make my questions easier to follow?It looks good, but without some sample data and the results you want from that data, I can't say for sure.
    Please post CREATE TABLE and INSERT statements (relevant columns only) for a little sample data, so that I (and the others who want to help you) can see exactly what your tables are like, and actually try our solutions. Simplify as much as possible. For example, if the data is actually coming from a multi-table join, but you already know how to join all the tables perfectly, then pretend all the data is in one table, and post CREATE TABLE and INSERT statements for that one table that looks sort of like your current result set. Post just enough data to show what you want to do. Based on what you've said so far, I'm guessing that 10 to 20 rows of raw data, resulting in 3 to 7 rows of output could give a nice example.
    Also, post the exact results you want from the sample data you post. Explain, with specific examples, how you get those results from that data.
    If parts of your desired output are optional (that is, if some parts "would be handy" or "could help") then post a couple of different sets of results from the same data, and explain, something like this:
    "What I'd really love to get for results is" ...
    but, if that makes things really complicated or inefficient, I don't absolutely need ... or ...,
    so I'd settle for these results: ..."
    I know it's a lot of work to post all this information, but it's really necessary. If I could help you without making you do all this, then I would. Unfortunately, I really don't have a good idea of where you're coming from or where you want to go.
    Edited by: Frank Kulash on Oct 19, 2010 8:01 PM

  • Decimal places diferent in BO SUM function than from DB

    Hi,
    I have a column from a Netezza database with 2 decimal places, if I apply a sum() function in BO (report) the decimal places are 4.
    The strange part is that if i do exact the same query in a DB2 database the decimal places are always two (like in DB) even if i use a sum function in report.
    There is some configuration regarding the database i'm using to set the decimal places in the report level to be the same than in DB?
    Edited: I've been studing the problem and I found using a odbc instead of a jdbc makes all the columns have 2 decimal places, and the sum problem doesn't happen. Now my issue is the division. How is possible that with the exact same values with two decimal positions, in BO and exporting to excel the last decimal place is different in some cases
    Example:
    Lets say A/B with A=13549678065,560000 and B= 21629484348,690000. With Netezza result is 62,6444803173527 and Db2  62,6444803173528
    Thanks for your time.

    I've never seen this particular problem before. Quite strange. It sounds more like an OLAP or SQL Server issue, not BPC.
    I'm not aware of any configuration on SQL server that allows you to control the decimal separator.
    I had a similar problem in the past, when my customer refused to follow the install guide instructions, and insisted that the server be set to non-US English regional settings. If I recall, the issue had to do with date formats not decimal separators. They ended up un-installing and re-installing the entire OS (with US English setup, the second time around), and then it worked fine. This was back on 5.0, and perhaps the situation has changed since then. There's a section in the master / install guide that covers the server-side language & regional settings in some detail.
    But before you look at that, try something easier -- is it possible that the cube is somehow corrupted? Do you get any errors when you process the application? Perhaps there is some data in the fact table with an invalid member ID.
    Do you get the same result in your Excel report when you use both EVDRE and EVGET?
    And if you browse the cube data in SQL Mgmt Studio (logging into the Analysis Services cube) do you see aggregated data there?
    Regards,
    Tim

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

  • Populating a collection with function results

    I am calculating some statistics and need to use a collection to store the results of several function so they can be used in a procedure. Example:
    PROCEDURE PRODUCTIVITY_INSERT(p_first_of_month IN DATE)
    AS
    BEGIN
    vc_FirstofMonth := p_first_of_month;
    FOR i IN 1..3 loop
    EXECUTE IMMEDIATE 'INSERT INTO RFC_BUS'||days(i)||'PRODUCTIVITY(ROUTE,PPPH)
    SELECT a.route, ((sr05 / sy05)/'||counts(i)||') AS "RATIO"
    FROM (SELECT route,
    SUM (DECODE (TO_CHAR (pick, "MM-YYYY"),
    to_char(vc_FirstofMonth, "MM-YYYY"), platform_hours, null)) AS sy05
    FROM bus_platformhours
    WHERE day_type ='||days(i)||' and platform_hours > 0
    GROUP BY route) a,
    (SELECT route,
    SUM (DECODE (TO_CHAR (service_date, "mm-yyyy"),
    to_char(vc_FirstofMonth, "MM-YYYY"), rides, null)) AS sr05
    FROM bush_daily_rides
    WHERE day_type = '||days(i)||
    'GROUP BY route) b
    WHERE a.route = b.route
    ORDER BY a.route
    VALUES(
    p_route,
    p_ratio
    ) USING days(i), counts(i)';
    end loop;
    Can I use collections to hold the function results (say three function out variables) while they are being looped through in the procedure? If I can do that I am presuming I use the functions name in the collection such as:
    TYPE dayoneList IS TABLE OF NUMBER;
    dayone dayoneList := dayoneList(wkdaysminusone(), sadaysminusone(), sudaysminusone());
    thanks for any help you can give me.

    Do you mean to use the functions as the elements of collection constructor ?
    It's possible:
    SQL> create function get_one return number is begin return 1; end;
      2  /
    Function created.
    SQL> create function get_two return number is begin return 2; end;
      2  /
    Function created.
    SQL> declare
      2   type arr is table of number;
      3   arr1 arr := arr(get_one(), get_two());
      4  begin
      5   for i in 1..arr1.count loop
      6    dbms_output.put_line(arr1(i));
      7   end loop;
      8  end;
      9  /
    1
    2
    PL/SQL procedure successfully completed.Rgds.

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

  • Please help me at this query (sum function)

    hi every one
    if I have column and the datatype is varchar2 and in this column has data like
    number,number mix varchar2,and character
    i want use sum function to summarize then number only but i want to ignore any number with char
    this example
    12
    23
    1q2
    wer
    34rt
    the result=35
    thanks in advance

    Not sure what you need here.
    However here is a sample of what's possible:
    SQL> WITH test_data AS
      2  (
      3          SELECT '12' AS DAT FROM DUAL UNION ALL
      4          SELECT '23' AS DAT FROM DUAL UNION ALL
      5          SELECT '1q2' AS DAT FROM DUAL UNION ALL
      6          SELECT '34rt' AS DAT FROM DUAL
      7  )
      8  SELECT  SUM(DAT)
      9  FROM    test_data
    10  WHERE   NOT REGEXP_LIKE(DAT,'[^[:digit:]]')
    11  /
      SUM(DAT)
            35

Maybe you are looking for

  • Blue Screen of death on Tecra M10 runing Win XP

    My Toshiba Tecra M10 has been running like a dream for three years never once hiccuping UNTIL the other day. My Toshiba Laptop is constantly cycling with a BSoD - then i goes to start windows - it looks like it is going to succeed - it gets to the pa

  • Problem with Blob key legnth in MySQL & JBoss

    Hi, I am using MySQL 3.23.55, JBOSS 3.0.6, EJB 2.0, CMP 2.0 I have configured the database, the tables are created but it stops at one place.In the type mappings-mappings , i have the following in the standardjbosscmp-jdbc.xml java-type jdbc-type sql

  • Termination does not appear as fail sequence

    Hi, I have I a subsequence than include some Action type step.  The step set a local variable.  Based on that variable I decide whether to continue or to terminate. In the event of termination, the process is indeed terminated, but when I look at the

  • Converting files into Word

    Can you please tell me what version of Word PDF converts into Word?

  • Best way to handle session timeout

    Hello All, oracle 11g, Apex ver 3.1.2 I am bit confused about the sessoin handling mecahnism for the users . Which is the best way to handle session for the users is it programatically or by DBA admin level. What are the pros and cons going DBA Level