How to calculate this column (Last Week of month)?

I have a request where it shows some calculations month wise
ex. This report is for Dec-2010
reporting line | Declined Rate | Approved Rate | Last-Week Declined Rate |
Report Asia---| ------20%----- | -----45%-------- | --------4%------ |
Report Africa-| ------44% -----| -----21%-------- | ------12%-------|
I am trying to calculate the Last Week Declined Rate column. The logic is just not coming to my mind.
Can anybody suggest me how should I calculate this?

Let's see. Running this report anytime after the previous month has closed...
1) TIMESTAMPADD(SQL_TSI_DAY, (DayOfMonth(CURRENT_DATE))*-1, CURRENT_DATE) will give you the last day of the previous month...
2) TIMESTAMPADD(SQL_TSI_DAY,DAYOFWEEK(TIMESTAMPADD(SQL_TSI_DAY, (DayOfMonth(CURRENT_DATE))*-1, CURRENT_DATE))*-1,TIMESTAMPADD(SQL_TSI_DAY, (DayOfMonth(CURRENT_DATE))*-1, CURRENT_DATE)) will give you the Saturday prior to the last week of the month.
3) TIMESTAMPADD(SQL_TSI_DAY,1,TIMESTAMPADD(SQL_TSI_DAY,DAYOFWEEK(TIMESTAMPADD(SQL_TSI_DAY, (DayOfMonth(CURRENT_DATE))*-1, CURRENT_DATE))*-1,TIMESTAMPADD(SQL_TSI_DAY, (DayOfMonth(CURRENT_DATE))*-1, CURRENT_DATE))) will give you the Sunday of the last week of the previous month.
Now that you have the beginning of the last day of the previous week, you can build your filter... It will be "between 3) and 1)" above...

Similar Messages

  • Calculate Dates for Last week and next three weeks

    Hi,
    I have a report where I need to calculate dates between last week and the next three weeks (not counting current week). I'm familar with the first part, it could be done by using the LastFullweek function but not sure how I can avoid the current week and calculate the next three weeks.
    Any help is greatly appreciated.
    Thanks!

    ... and here are a few more...
    Last Week...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate), #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -1, #1/7/1900#)
    THEN TRUE ELSE FALSE
    The week before...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -1, #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -2, #1/7/1900#)
    THEN TRUE ELSE FALSE
    And the week before that...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -2, #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -3, #1/7/1900#)
    THEN TRUE ELSE FALSE
    and of course all 3 weeks together...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate), #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -3, #1/7/1900#)
    THEN TRUE ELSE FALSE
    If you want the 1st day of the week to be Monday instead of Sunday just change the date of #1/7/190# to #1/1/1900#
    HTH,
    Jason

  • My iTuens keeps waiting for a sync with my iPhone 4 that I have paired and synced up with for months. I had this problem last week then I installed the iTunes update and it synced okay for a few days.

    My iPhone is not snycing up to my iTunes like it used to thur my USB. I had this problem last week until I updated iTunes then it cleared up for a few days now its back. What can I do to fix it?

    I am reading on this site about the error I am getting and it wants me to change some files that I am not comfortable messing with. Mainly because it is like a foreign language. Will the store do this for me or tell me if it is neccessary?

  • HFR: How to calculate variation over last period for dynamic columns

    Hello Everyone,
                             How to calculate the period wise variation in a report where the period columns are dynamically generated from a range function? For example, the range function in the period column is &Current:Dec. What formula can I write in a calculated row so that the value is (Current  Period - Previous period)*100/Previous period ?
    Thanks,
    Sayantan

    You can add two more data rows.
    1. Use &Current
    2. Use relativemember function, select &Current, offset -1 (If you've a subvar for previous month that's the best)
    3. Add a formula row ([B]-[C]*100/[C])
    Regards
    Celvin
    http://www.orahyplabs.com

  • I am running version firefox 9.0.1, I can't chat using Yahoo? when I click the contact to chat NO popup window? This happened last week. What can I do?

    I am running Windows XP SP3. Firefox 9.0.1
    When I try to use Yahoo chat, the popup Window does not display!
    I can use iExplorer to chat.
    This started to happen since last week (Wed. or Thur I believe)
    I tried to disable all the add-ons but nothing. I've set the browser to default and nothing
    I can see someone send me a chat blinking but I can't use it, nothing in conversation history.
    How do I fix this?
    Thanks,
    Bill.

    Hi bdnao02,
    This sounds like a known issue reported here:
    https://bugzilla.mozilla.org/show_bug.cgi?id=713014
    There was a workaround posted, but I've not tested it myself.
    The bug has been resolved in Firefox 10, so you may want to try installing the Beta if you feel it is important enough.
    Hopefully this helps!

  • How to calculate YTD and Last year YTD on Date in Bex

    Hi,
    I have a requirement in which I need to show the report as following format.
    I need to show    Year>monthday as Hierarchy. user will drill down on Month to Date.
                 Del Qty              Ord Qty              Del  Qty LY              Del Qty YTD                  Del Qty  L YTD
    Year
    > Drill Down to Months
            Jan
            Feb
            Mar
              ---> 1.03.2010
              ---> 2.03.2010
              ---> 3.03.2010
            Dec
    I have Calday, Calmonth, Calyear all three objects.
    Now my question is how I can achive this? On which i need to create hierarchy?
    and how to calculate the YTD at day level.
    Note:- in the selection calyear is mandatory. User wants to display as per year.   So What infoobject I need to take in selection?
    and the way to calculate YTD on Day (in the case also ,where user doesn't give the date in selection)
    Plz reply asap its uregent !!!
    Thanks in advance,
    Amit

    Hi,
    As per my understanding I think YTD means JAN to current date result. I means say if user enter 062005 then result in YTD should be from 012005 to 062005.
    And to do this you need to write a customer exit variable where LOW field of internal table you will put JAN year and HIGH will contain month year entered by user.
    Hope this will help you.
    Suneel

  • How to get this column (SYSDATE-CREATEDON DATE)

    I have a reporting requirement to get a column subtracting two date fields and result gets displayed in days.
        I have a notification number with CreatedON date field in my DSO. Now for notification age, I have to subtract SYSDATE(which is current day)-CREATEDON date(for Notification Number)
      AGE(in days) = SYSDATE - CREATEDON DATE
    Can anyone give me some suggestion on how to fulfill this requirement?
    Thanks in Advance
    N

    Hi,
    The steps in Query designer 7 are :
    1) Open your Query
    2) Go to Columns area and create a structure and under this strcuture create a formula by context menu.
    3) In the edit screen of Formula : Right click on <i>Formula varibles</i>(Available operands) and select new varible
    4) Now select edit option from the context menu of the new varible :
    in general tab page take processing by <i>Customer Exit</i> and change the desription to FV1.
    in details tab page , take variable as  Mandatory and remove tick mark for <i>Ready for input</i>.
    In currency/unit tab page . take Dimensions as Date.
    5) Again ,In the edit screen of Formula : Right click on <i>Formula varibles</i>(Available operands) and select new varible
    6) Now select edit option from the context menu of the new varible :
    In general tab page take processing by <i>Replace ment path</i> and change the desription to FV2.And Take 0NOTIFICATION as <i>reference Characterstic</i>.
    In the REplace ment path tab page , Attribute value for<i> Varibale represents</i> and tehn take CREATEDON as the <i>Attribute</i>.
    In details tab page , take variable as  Mandatory and remove tick mark for <i>Ready for input</i>.
    In currency/unit tab page . take Dimensions as Date.
    7) Now in te formula created in teh step 2  , take FV1-Fv2 as <i>Detail View</i>
    8) Write the code for FV1 in Cmod as below:
    DATA: L_S_RANGE TYPE RSR_S_RANGESID.
    DATA: L_S_RANGE2 TYPE RSR_S_RANGESID.
    DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
    DATA: LOC_VAR_RANGE2 LIKE RRRANGEEXIT.
    CASE I_VNAM.
    WHEN 'ZFV1'.
        IF I_STEP = 2.
             L_S_RANGE-LOW = sy-datum.
            L_S_RANGE-SIGN = 'I'.
            L_S_RANGE-OPT  = 'EQ'.
            APPEND L_S_RANGE TO E_T_RANGE.
          ENDLOOP.
        ENDIF.
    endcase.
    With rgds,
    Anil Kumar Sharma .P
    With rgds,
    Anil Kuamr Sharma .P

  • How to calculate the measure for the next month using the AGO Function

    Hi,
    I need to calculate the measure for the current month and the next month.
    Can anyone please let me know the syntax to use AGO function for the above requirement.
    Regards,
    Ambika Nanda.

    Hi.
    You can also use Oracle analytic functions LAG and LEAD inside the EVALUATE obiee function. The second one will give you the next measure.
    For example the report is:
    TIMES.CALENDAR_MONTH_DESC
    SALES.AMOUNT_SOLD
    LAG column: EVALUATE('LAG(%1, 1) OVER (ORDER BY %2)' AS DOUBLE, SALES.AMOUNT_SOLD, TIMES.CALENDAR_MONTH_DESC)
    LEAD column: EVALUATE('LEAD(%1, 1) OVER (ORDER BY %2)' AS DOUBLE, SALES.AMOUNT_SOLD, TIMES.CALENDAR_MONTH_DESC)
    And the result is:
    CALENDAR_MONTH_DESC--------AMOUNT_SOLD--------LAG--------------LEAD
    2000-01----------------------------------8025513.84---------------------------8474475.88
    2000-02----------------------------------8474475.88----- 8025513.84-----7439568.24
    2000-03----------------------------------7439568.24------8474475.88-----7062040.48
    2000-04----------------------------------7062040.48------7439568.24-----7497971.40
    Regards
    Goran
    http://108obiee.blogspot.com

  • How to calculate a column bases on the result of another column?

    Hello folks, i need some help with this senario.
    I don't know to explain this in a simple way, but i'll give it a go.
    I display a report in ApplicationExpress like this
    Each row displays a product where the user are going to make a forecast for 18 months ahead.
    [productname] [Stock] [sales] [PMonth] [NewstockMonth] [salesmonth1]      [ProductionMonth1]     [NewstockMonth1] ....
    [product1]______[10]____[5]____[0]_________[5]__________[10]_________[10]______________[5]
    [product2]______[2 ]____[0]____[0]_________[2]__________[5]__________[10]______________[ 7]
    [product3]______[30]____[20]___[0]_________[10]_________[5]_________[10]______________[15]
    Stock and sales are results of a function i have in my select.
    productionmonth is a text field where the user can edit the production and is saved in the table.
    So when the user has entered some inputs in the textboxes, and pressed the submit buttom, the newstockmonth columns
    should be calculated from the result i get from the previous month.
    newstockmonth = (stock-sales)+productionMonth
    newstockmonth1 =(newstockmonth-salesmonth1)+productionmonth1
    At this point my submit process has update in a for loop for each row. But i don't quite know how i can calculate every newstockmonth columns.

    Hi Klaus,
    your condition only works if the Shop is in the query. If I understood it correctly you have one query with
    Country   Shop   Total Sales
    and one with
    Country   Number of Shops   Total Sales
    and you don't want to restrict the second Total Sales but the Total Sales from the first query.
    Best regards
       Dirk

  • How to calculate this average cost ?

    Hello,
    I've been thinking on this for problem for a while, but could not come up with a solution. In excel it is easy to do, but in SQL ?
    Tried with analytics but no success.
    I need to recalculate the AVG_PRICE when QUANTITY > 0, ie when I buy, else AVG_PRICE = prior AVG_PRICE.
    these are the rules:
    QTY_ON_HAND is a running total of QUANTITY
    TOTAL_COST = AVG_PRICE * QTY_ON_HAND
    AVG_PRICE = ( TOTAL_COST (preceding row) + TRADE_AMOUNT (current row) ) / QTY_ON_HAND
    Group is FUND_CODE, INSTRUMENT_TYPE, INSTRUMENT_CODE
    Order is by TRADE_DATE
    the numbers I need are on the last row of the .CSV file
    AVG_PRICE = 797.0237644
    QTY_ON_HAND = 1'327.137600
    TOTAL_COST = 1'057'760.21
    Any help is more than welcome
    thank you
    Claudio
    this is the data:
    CREATE TABLE t (
    "FUND_CODE" NVARCHAR2(3),
    "INSTRUMENT_TYPE" NVARCHAR2(4),
    "INSTRUMENT_CODE" NVARCHAR2(15),
    "TRADE_DATE" TIMESTAMP,
    "QUANTITY" NUMBER,
    "TRADE_AMOUNT" NUMBER
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('01-10-2007 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 115.2502, -92411.183116);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('05-12-2007 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 318.4801, -336101.285453);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('11-01-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -64.6781, 67647.083502);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('25-01-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 72.5117, -109197.254334);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('01-02-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 87.1223, -123386.870253);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('29-02-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 110.869, -93957.707954);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('06-03-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -55.2563, 49721.994761);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('12-03-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 164.4146, -135834.245667);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('18-03-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -37.6276, 41342.685831);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('27-03-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 159.1288, -112293.21594);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('01-05-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 64.6638, -46458.289084);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('23-05-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 137.3465, -85979.32104);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('04-06-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 156.0562, -86183.26);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('01-07-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -342.5453, 265491.46);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('11-08-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -175.8868, 170185.92);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('26-08-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 143.9074, -124927.73);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('28-10-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -321.3085, 472031.39);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('03-11-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), -85.2822, 73202.14);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('01-12-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 38.1563, -27117.03);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('02-12-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 168.331, -135004.83);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('04-12-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 606.1362, -461853.36);
    INSERT INTO t ("FUND_CODE", "INSTRUMENT_TYPE", "INSTRUMENT_CODE", "TRADE_DATE", "QUANTITY", "TRADE_AMOUNT")
    VALUES ('CLF', 'ifus', 'CLCX', TO_DATE('10-12-2008 12:00:00 AM','DD-MM-YYYY HH:MI:SS AM'), 67.3483, -47610.26);
    COMMIT;
    this is the result in .CSV format, so that you can "see it" in a spreadsheet
    FUND_CODE;INSTRUMENT_TYPE;INSTRUMENT_CODE;TRADE_DATE;QUANTITY;TRADE_AMOUNT;AVG_PRICE;QTY_ON_HAND;TOTAL_COST
    CLF;ifus;CLCX;01.10.07;115.250200 ;-92411.18312;801.831;115.250200 ;92'411.18
    CLF;ifus;CLCX;05.12.07;318.480100 ;-336101.2855;987.9698711;433.730300 ;428'512.47
    CLF;ifus;CLCX;11.01.08;-64.678100 ;67647.0835;987.9698711;369.052200 ;364'612.45
    CLF;ifus;CLCX;25.01.08;72.511700 ;-109197.2543;1073.02637;441.563900 ;473'809.71
    CLF;ifus;CLCX;01.02.08;87.122300 ;-123386.8703;1129.586093;528.686200 ;597'196.58
    CLF;ifus;CLCX;29.02.08;110.869000 ;-93957.70795;1080.679646;639.555200 ;691'154.29
    CLF;ifus;CLCX;06.03.08;-55.256300 ;49721.99476;1080.679646;584.298900 ;631'439.93
    CLF;ifus;CLCX;12.03.08;164.414600 ;-135834.2457;1024.790089;748.713500 ;767'274.17
    CLF;ifus;CLCX;18.03.08;-37.627600 ;41342.68583;1024.790089;711.085900 ;728'713.78
    CLF;ifus;CLCX;27.03.08;159.128800 ;-112293.2159;966.4362121;870.214700 ;841'007.00
    CLF;ifus;CLCX;01.05.08;64.663800 ;-46458.28908;949.2840914;934.878500 ;887'465.29
    CLF;ifus;CLCX;23.05.08;137.346500 ;-85979.32104;907.8734486;1'072.225000 ;973'444.61
    CLF;ifus;CLCX;04.06.08;156.056200 ;-86183.26;862.6915958;1'228.281200 ;1'059'627.87
    CLF;ifus;CLCX;01.07.08;-342.545300 ;265491.46;862.6915958;885.735900 ;764'116.92
    CLF;ifus;CLCX;11.08.08;-175.886800 ;170185.92;862.6915958;709.849100 ;612'380.85
    CLF;ifus;CLCX;26.08.08;143.907400 ;-124927.73;863.605235;853.756500 ;737'308.58;
    CLF;ifus;CLCX;28.10.08;-321.308500 ;472031.39;863.605235;532.448000 ;459'824.88;
    CLF;ifus;CLCX;03.11.08;-85.282200 ;73202.14;863.605235;447.165800 ;386'174.73;
    CLF;ifus;CLCX;01.12.08;38.156300 ;-27117.03;851.582394;485.322100 ;413'291.76;
    CLF;ifus;CLCX;02.12.08;168.331000 ;-135004.83;838.8189176;653.653100 ;548'296.59;
    CLF;ifus;CLCX;04.12.08;606.136200 ;-461853.36;801.8403917;1'259.789300 ;1'010'149.95;
    CLF;ifus;CLCX;10.12.08;67.348300 ;-47610.26;797.0237644;1'327.137600 ;1'057'760.21;

    this is how the numbers have to be:
    fund    instr   instr   trade_date       quantity        trade_amount    avg_price     qty_on_hand        total_cost
    code    type    code   
    CLF     ifus     CLCX     01.10.2007      115.2502      -92'411.1831       801.8310       115.2502        92'411.18
    CLF     ifus     CLCX     05.12.2007      318.4801     -336'101.2855       987.9699       433.7303       428'512.47
    CLF     ifus     CLCX     11.01.2008      -64.6781       67'647.0835       987.9699       369.0522       364'612.45
    CLF     ifus     CLCX     25.01.2008       72.5117     -109'197.2543     1'073.0264       441.5639       473'809.71
    CLF     ifus     CLCX     01.02.2008       87.1223     -123'386.8703     1'129.5861       528.6862       597'196.58
    CLF     ifus     CLCX     29.02.2008       110.869      -93'957.7080     1'080.6796       639.5552       691'154.29
    CLF     ifus     CLCX     06.03.2008      -55.2563       49'721.9948     1'080.6796       584.2989       631'439.93
    CLF     ifus     CLCX     12.03.2008      164.4146     -135'834.2457     1'024.7901       748.7135       767'274.17
    CLF     ifus     CLCX     18.03.2008      -37.6276       41'342.6858     1'024.7901       711.0859       728'713.78
    CLF     ifus     CLCX     27.03.2008      159.1288     -112'293.2159       966.4362       870.2147       841'007.00
    CLF     ifus     CLCX     01.05.2008       64.6638      -46'458.2891       949.2841       934.8785       887'465.29
    CLF     ifus     CLCX     23.05.2008      137.3465      -85'979.3210       907.8734     1'072.2250       973'444.61
    CLF     ifus     CLCX     04.06.2008      156.0562      -86'183.2600       862.6916     1'228.2812     1'059'627.87
    CLF     ifus     CLCX     01.07.2008     -342.5453      265'491.4600       862.6916       885.7359       764'116.92
    CLF     ifus     CLCX     11.08.2008     -175.8868      170'185.9200       862.6916       709.8491       612'380.85
    CLF     ifus     CLCX     26.08.2008      143.9074     -124'927.7300       863.6052       853.7565       737'308.58
    CLF     ifus     CLCX     28.10.2008     -321.3085      472'031.3900       863.6052       532.4480       459'824.88
    CLF     ifus     CLCX     03.11.2008      -85.2822       73'202.1400       863.6052       447.1658       386'174.73
    CLF     ifus     CLCX     01.12.2008       38.1563      -27'117.0300       851.5824       485.3221       413'291.76
    CLF     ifus     CLCX     02.12.2008       168.331     -135'004.8300       838.8189       653.6531       548'296.59
    CLF     ifus     CLCX     04.12.2008      606.1362     -461'853.3600       801.8404     1'259.7893     1'010'149.95
    CLF     ifus     CLCX     10.12.2008       67.3483      -47'610.2600       797.0238     1'327.1376     1'057'760.21As you can see on the 3rd line we have a Sell -64.67, thus we take the previous AVG_PRICE.
    Keep in mind that:
    AVG_PRICE = (TOTAL_COST preceding row + TRADE_AMOUNT current row) / QTY_ON_HAND is calculated only on Buy QUANTITY > 0
    TOTAL_COST = QTY_ON_HAND * AVG_PRICE
    this is the output of the query kindly suggested by Alex:
    FUND_CODE INSTRUMENT_TYPE INSTRUMENT_CODE                TRADE_DATE                     QUANTITY         TRADE_AMOUNT          QTY_ON_HAND           TOTAL_COST            AVG_PRICE
    CLF       ifus            CLCX                           01.10.2007 00:00               115.2502        -92411.183116             115.2502        -92411.183116    -801.830999998265
    CLF       ifus            CLCX                           05.12.2007 00:00               318.4801       -336101.285453             433.7303       -428512.468569    -987.969871067343
    CLF       ifus            CLCX                           11.01.2008 00:00               -64.6781         67647.083502             369.0522       -360865.385067    -987.969871067343
    CLF       ifus            CLCX                           25.01.2008 00:00                72.5117       -109197.254334             441.5639       -470062.639401    -1064.54046492705
    CLF       ifus            CLCX                           01.02.2008 00:00                87.1223       -123386.870253             528.6862       -593449.509654     -1122.4985816804
    CLF       ifus            CLCX                           29.02.2008 00:00                110.869        -93957.707954             639.5552       -687407.217608    -1074.82077795318
    CLF       ifus            CLCX                           06.03.2008 00:00               -55.2563         49721.994761             584.2989       -637685.222847    -1074.82077795318
    CLF       ifus            CLCX                           12.03.2008 00:00               164.4146       -135834.245667             748.7135       -773519.468514    -1033.13145617649
    CLF       ifus            CLCX                           18.03.2008 00:00               -37.6276         41342.685831             711.0859       -732176.782683    -1033.13145617649
    CLF       ifus            CLCX                           27.03.2008 00:00               159.1288        -112293.21594             870.2147       -844469.998623    -970.415690085447
    CLF       ifus            CLCX                           01.05.2008 00:00                64.6638        -46458.289084             934.8785       -890928.287707      -952.9883163502
    CLF       ifus            CLCX                           23.05.2008 00:00               137.3465         -85979.32104             1072.225       -976907.608747    -911.103181465644
    CLF       ifus            CLCX                           04.06.2008 00:00               156.0562            -86183.26            1228.2812      -1063090.868747    -865.510982946739
    CLF       ifus            CLCX                           01.07.2008 00:00              -342.5453            265491.46             885.7359       -797599.408747    -865.510982946739
    CLF       ifus            CLCX                           11.08.2008 00:00              -175.8868            170185.92             709.8491       -627413.488747    -900.493486542659
    CLF       ifus            CLCX                           26.08.2008 00:00               143.9074           -124927.73             853.7565       -752341.218747    -881.212873632002
    CLF       ifus            CLCX                           28.10.2008 00:00              -321.3085            472031.39              532.448       -280309.828747    -881.212873632002
    CLF       ifus            CLCX                           03.11.2008 00:00               -85.2822             73202.14             447.1658       -207107.688747    -526.454843941568
    CLF       ifus            CLCX                           01.12.2008 00:00                38.1563            -27117.03             485.3221       -234224.718747    -482.617047002393
    CLF       ifus            CLCX                           02.12.2008 00:00                168.331           -135004.83             653.6531       -369229.548747    -564.870798818211
    CLF       ifus            CLCX                           04.12.2008 00:00               606.1362           -461853.36            1259.7893       -831082.908747    -659.699926604393
    CLF       ifus            CLCX                           10.12.2008 00:00                67.3483            -47610.26            1327.1376       -878693.168747    -662.096506607152 As I said I'll try to elaborate on the idea of Alex, does not mean that I don't need any other help.
    ON THE CONTRARY !
    Any help is more than welcome.
    Sorry again if I am not clear in my posting, this is my first time, have patience please.
    thanks again
    Claudio

  • My internet hasn't been working with out wi fi. It's been like this since last week!!

    oh boy!! No facebook! No navigator! No nothing! I saw my phone wasn't working the right way when I had step out of my house and notice I couldn't update my status on facebook. So I thought maybe reseting it would help but ehh no help. So when I got home I notice it was working great. So I thought the phone was fixed. But I guess I was wrong when I had step outside again. So then I thought my phone was just acting slow, because earlier that day I had texted my sister and she ended up getting my message an hour late. So I took a real good look at my phone and notice that it had said that I had no wi fi (which is weird because I always had wi fi EVERYWHERE I went) and then I notice that where it's normally my carriers name(sprint) it had been replaced with "offline". I really didn't know what that ment so I decided to call a friend who has a palm pre as well but as I tried calling him, my call was not going through. So basically I could only use my phone when I'm in my house, which are the moments when I least need a phone. I'm just wondering is there any form of solution? Or do I need a new phone?
    Post relates to: Pre p100eww (Sprint)

    If your device is in offline mode you can try entering airplane mode and then go back to normal to see if this will get it out of offline mode. If this does not work you can try a restart from Device Info, Reset Options, Restart, then go in and out of airplane mode again. IF this does not work then you can try an erase app and data from the same Device Info (this will remove all data on your device) and then try going in and out of airplane mode. If none of theses options work then you can try Web OS Doctor to restore your software on the device. The last option would be to get a replacement device.
    Remember when Wi-Fi is on and connected this will disable you cellular data connection. Be sure this is not what is happening. If you have data at home with Wi-Fi, and then leave you home and do not have Wi-Fi you need to make sure your device is switching back to EV on your status bar to have a data connection. 

  • Already deleted "squlite", still crashing 2-3 times when i am web brousing, never did this before last week, running on XP, please advise.

    Just downloaded up-dates; will see how that works.

        I can see that this issue has been quite extensive, and frustrating, and I am so sorry for all that has happened societygirl! I would like to help you work this issue out. Please follow & send me a Direct Message, so I can get your account specifics and help finally bring this to a resolution.
    Thank you,
    MichelleH_VZW
    Follow us on Twitter @VZWSupport

  • I am getting an error message that "no photos could be found on this device" when I plug in my ipad to my windows 8.  I open the dcim folder and it shows up empty, although I clearly have photos on my ipad.  I was able to do this just last week.  HELP!

    Help, I am trying to get my pictures from my ipad to my computer (windows 8) and I get the message that "no photos could be found on this device."  When I try to open the dcim folder, it shows up empty.  What can I do?  I have previously been able to import pictures easily.

    Hi, I had the same problem. I finally figured it out. Plug in the USB cord to your ipad, but beofre plugging it into your computer make sure your ipad is not in the locked or sleep mode. Once I did this, my photos showed up and started downloading. Hope that helps you!

  • TS2972 I'm logged into my apple account in Itunes, my home sharing is on, still my computer and libraries are not showing.  This happend last week and I figured out that I wasn't signed in.  I'm signed in now, what is causing this?

    Can anyone help with the apple tv dilemma

    That's a very interesting find. A couple people have been reporting this. But we thought it was Google breaking that page on purpose because they plan to remove that special Firefox search page. They think it's too old and want people to switch to the newer one. But I'm still not sure why being signed into Google breaks that page (and signing out fixes it), I believe Google is at fault here and needs to update the code on that page.
    The new Google search page for Firefox is:
    <br>'''about:home'''
    Screenshot:
    <br> http://i.minus.com/iewA9S.PNG
    It's a special page built into the Firefox browser. That's why it has a weird website address that doesn't look like normal websites that use http://www., .com, .net, or .org.

  • How to calculate no of day in a month

    Hi All,
    I am have one cube in that i am getting only fiscalyear/period and variant.
    now my question is how calculate no of day in my fiscalyear/period (ex : 007.2010) this month of oct .is is possible in update rules.
    or it can be possible in report level
    for this i required ABAP logic any one help on this.
    Reagrds
    Anil

    In update rule / transformation write routine, in routine use function module /OSP/GET_DAYS_IN_MONTH. pass  period/month as input to routine/FM & output of this function module get into one variable & pass that variable to result.
    CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'
      EXPORTING
        iv_date       = SOURCE_FIELDS-fiscper
    IMPORTING
       EV_DAYS       = days
    Result =  days
    Days is a variable declare locally in routine
    Edited by: Swapnil Dharia on Jan 14, 2010 2:36 PM

Maybe you are looking for