Row wise running total

is there any method to create row wise running total in Crystal Reports?

>
gourav.sengupta wrote:
> Hi,
>
> I needed a running total but for rows. Therefore if the data set is in the following manner:
>
> Column 1             Column 2             Column 3             Column 4
> A                         12                       13                       14
> B                         11                       10                       19
>
> The the running total will appear as:
> RT                        23                       23                       33
>
>
> Thanks and Regards,
> Gourav
I am confused as to what you want.
Your sample shows sums for collumns, not rows. You do not need a running total for this, just sum them.
If you want to total each row, make a formula that adds them up and place on the row.

Similar Messages

  • Running totals at the footer of the report

    I want to create running totals but print them not in e.g. in a group footer. All totals should be printed at the end of the report. The number of needed running totals is not defined before, it depends on the number of different grouping criterias:
    Example
    Criteria   Amount
    1995      10
    1995       10
    1996       20
    1997       30
    1997       10
    At the end of the report shoul appear the following:
    1995     20
    1996     20
    1997     40
    There could be more criteria in the report (e.g. 1998 or 1999), but it is not defined before I start the report.
    Thank you for your support

    Hi Torsten,
    If you want to create year wise running totals without considering groups, you can create like :
    go in Field ExplorerRunning TotalsRight click and select New
    Give the name as 1995 and select Field to summarize and select Sum as type of summary
    In Evaluate select Formula and give a formula like : Year = 1995
    In Reset do not reset.  You get the value of 1995 year this can be placed at the end of your report.
    You may have to create different funning total for different year.
    Thanks,
    Sastry

  • Row wise total in editable ALV

    hello all,
                I am workin on editable alv, the user need to enter the values in the editable fields and in the last column(non-editable) i need to populate the total row wise,as soon as user enters a value and goes to next editable cell or on entering a vale and press enter.how to accomplish this task...
    with regards,
    sandeep akella.
    Edited by: sandeep akella on Aug 20, 2009 1:58 PM

    You need to Implement the OnCellAction event.follow these steps;
    1. Goto WDDOMODIFYVIEW and place the following code
    IF first_time IS INITIAL.
        DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
        lo_cmp_usage =   wd_this->wd_cpuse_usg_alv( ).
        IF lo_cmp_usage->has_active_component( ) IS INITIAL.
          lo_cmp_usage->create_component( ).
        ENDIF.
        DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
        lo_interfacecontroller =   wd_this->wd_cpifc_usg_alv( ).
        DATA lo_value TYPE REF TO cl_salv_wd_config_table.
        lo_value = lo_interfacecontroller->get_model(
        CALL METHOD lo_value->if_salv_wd_table_settings~set_cell_action_event_enabled
         EXPORTING
            value = abap_true.
      ENDIF.
    2. Implement the onCellAction event as follows;
        Goto Methods tab, create a new method. Method Type- Event Handler , Event - ON_CELL_ACTION
    3. Now in this  method retrive the contents of the row and calculate the value as follows.
    DATA: l_element TYPE REF TO if_wd_context_element.
      DATA:ls_stru TYPE wd_this->element_cn_alv.
      DATA: l_node TYPE REF TO if_wd_context_node.
      l_node  = wd_context->get_child_node( 'CN_ALV' ).
      l_element = l_node->get_element(  r_param->index ).
      l_element->get_static_attributes( IMPORTING static_attributes = ls_stru ).
      ls_stru-last_col = ls_stru-col1+ls_stru-col2....+ ls_stru-col5. " add all the cells data
      l_element->set_static_attributes( exporting static_attributes = ls_stru ).

  • In alvs how to do totals by colum wise and row wise

    hi,
    in alvs how to do totals by colum wise and row wise
    could u plz explain clearly with coding

    Hi Rajesh,
    Go through these links...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    Reward Points if this helps,
    Satish

  • Running total for duplicate rows

    Hi,
    I am trying to write an sql which shows the running total for records which has duplicate. Please share any idea to get this.
    sample rows:
    col1 col2 col3
    1      A    2
    1      A    2
    1      A    2
    1      B    3
    1      B    3
    1      C    5
    1      D    2
    1      D    2o/p required:
    col1 col2 col3  cumulative_tot
    1      A    2       2
    1      A    2       2
    1      A    2       2
    1      B    3       5
    1      B    3       5
    1      C    5       10
    1      D    2       12
    1      D    2       12

    Hi,
    Try this:
    WITH A AS
    select 1 col1,  'A' col2, 2 col3  from dual union all
    select 1 col1,  'A' col2, 2 col3  from dual union all
    select 1 col1,  'A' col2, 2 col3  from dual union all
    select 1 col1,  'B' col2, 3 col3  from dual union all
    select 1 col1,  'B' col2, 3 col3  from dual union all
    select 1 col1,  'C' col2, 5 col3  from dual union all
    select 1 col1,  'D' col2, 2 col3  from dual union all
    select 1 col1,  'D' col2, 2 col3  from dual
    ,B AS
    SELECT
      A.*
      ,ROW_NUMBER() OVER (PARTITION BY COL1, COL2 ORDER BY 1) RN
    FROM
      A
    SELECT
      B.*
      ,SUM(CASE WHEN RN = 1 THEN COL3 ELSE 0 END) OVER ( ORDER BY COL1, COL2 ,RN ) cumulative_tot
    FROM
      B
    COL1 COL2 COL3 RN CUMULATIVE_TOT
       1 A       2  1              2
       1 A       2  2              2
       1 A       2  3              2
       1 B       3  1              5
       1 B       3  2              5
       1 C       5  1             10
       1 D       2  1             12
       1 D       2  2             12
    8 rows selected Regards,
    Peter

  • Ordering row wise totals in a column.

    Hi,
    I have a report in Pivot view having two columns namely Count and Category. I have to apply sort on these two columns-first on Count and then on Category.
    The Total Count is also calculated row wise. Now when I apply sort on count column, only the values in that column are being sorted and not according to row wise total count. But my requirement is to sort the total count row wise first and then by Category.I am unable to do so.
    Kindly provide me the solution to this problem.
    Thanks
    Ankita

    Use RunningSum() function.
    Regards,
    Rohit

  • Single Bottom row Sum of running total

    That's a terrible title.  LOL  Sorry.  Here's what I am doing in Numbers '08---I am setting up my budget, and I have several small tables for my various categories like Mortgage or Grocery.  In each small table, I have a very simple structure of a Date Column, an Expense Column and a Deposit Column and a Running Total.
    Mortgage Da
    Expense
    Deposit
    Running Tot
    $0
    Jan 1, 2014
    $1,770.19
    $1,770.19
    Jan 7, 2014
    $1,770.19
    $0.00
    Jan 23, 2014
    $885.09
    $885.09
    Sorry its not pretty.  OK, SO, WHAT I WANT is to be able to have a single cell at the bottom of the chart that constantly shows the last running total amount.  When I make a new expense or deposit, that $885.09 will go up or down and be shown on the next row.  BUT, I want to be able to have that next running total still shown in one lower, bottom row sum total.
    What I am trying to do with that is then have a general check book budget list of the main categories.  I want to take the bottom row sum total for Mortgage or Internet or Grocery and the other tables into one single list.   That list of categories would constantly stay current based on the information I put into the different tables.  In that master list, what is there allows me to see a global look at my budget, and (hopefully) should match my checkbook.
    Any ideas?

    Hi Carl,
    WHAT I WANT is to be able to have a single cell at the bottom of the chart that constantly shows the last running total amount. 
    Is something like this what you mean?
    Row 1 is a Header Row.  Row 8 is a Footer Row. The formula in D8 is:
              =INDEX(D,COUNTA(D)+1,1)
    It counts the number of non-blank cells in column D and uses that count to retrieve the value in the last cell in that column that is not blank.
    SG

  • Running total of calculated field in pivot

    VERSION: ORACLE 11
    TABLE:
    create table chart_detail (
    DIS        NUMBER,
    BLD_MO VARCHAR2(7),
    BLD        NUMBER(10),
    RPLC      NUMBER(10));DATA:
    insert into chart_detail values (60,'2011-03',0,2);
    insert into chart_detail values (150,'2011-04',10572,0);
    insert into chart_detail values (120,'2011-04',26449,5);
    insert into chart_detail values (30,'2011-04',0,1);
    insert into chart_detail values (60,'2011-04',0,7);
    insert into chart_detail values (90,'2011-04',0,9);
    insert into chart_detail values (120,'2011-05',5714,0);
    insert into chart_detail values (90,'2011-05',24557,1);
    insert into chart_detail values (60,'2011-05',0,4);
    insert into chart_detail values (30,'2011-05',0,0);
    COMMIT;EXPECTED RESULTS:
         2011-04                    2011-05               
    DIS     RPLC     BLD     TBLD     IPTV     RPLC     BLD     TBLD     IPTV
    30     1     0     37021     0.03     0     0     30271     0.00
    60     7     0     37021     0.22     4     0     30271     0.13
    90     9     0     37021     0.46     1     24557     30271     0.17
    120     5     26449     37021     0.59     0     5714     5714     0.17
    150     0     10572     10572     0.59               0     
    180               0                    0     
    TOTAL     22     37021               5     30271          PROBLEM: I need to have a running total of IPTV like in the above example. I can get the IPTV for each DIS/bld_mo but I don't know how to get the running total of it. In the script below I just used an example where I tried summing the IPTV like was done for build. I know it can't be done that way because IPTV is a calculated field in the query but if I substitute "APR_IPTV" with the formula for IPTV I get an error that window functions aren't allowed here. I do not know a way around this. I commented out the bad piece of code.
    PROBLEM SCRIPT:
    WITH  pivot_results  AS
      SELECT    dis
      ,    NVL (apr11_rep,  0)  AS apr11_rep
      ,    NVL (apr11_bld,   0)  AS apr11_bld
      ,    NVL ( SUM (apr11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0
                    )        AS apr11_tbld
    ,      DECODE(NVL ( SUM (apr11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(apr11_rep, 0)*1000/ NVL ( SUM (apr11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS apr11_iptv               
    ,      NVL ( SUM (apr11_iptv)
                      OVER (ORDER BY dis DESC)
                    ,                 0
                    )        AS apr11_tiptv  
      ,    NVL (may11_rep,  0)  AS may11_rep
      ,    NVL (may11_bld,   0)  AS may11_bld
      ,    NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0
                    )        AS may11_tbld
    ,      DECODE(NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS may11_iptv
    ,      DECODE(NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS may11_tiptv               
      FROM     chart_detail
      PIVOT     (  MAX (rplc)  AS rep
              ,  MAX (bld)  AS bld
              FOR  bld_mo   IN ( '2011-04'  AS apr11
                                             , '2011-05'  AS may11
    SELECT    CASE
            WHEN  GROUPING (dis) = 0
            THEN  TO_CHAR (dis)
            ELSE  'Total'
        END      AS dis
    ,    SUM (apr11_rep)  AS apr11_rep
    ,    SUM (apr11_bld)  AS apr11_bld
    ,    SUM (apr11_tbld) AS apr11_tbld
    ,    CASE
            WHEN  GROUPING (dis) = 0
            THEN  SUM (apr11_iptv)
        END      AS apr11_iptv
    ,    SUM (apr11_tiptv) AS apr11_tiptv
    ,    CASE
            WHEN  GROUPING (dis) = 0
            THEN  SUM (apr11_tpiptv)
        END      AS apr11_tiptv
    ,    SUM (may11_rep)  AS may11_rep
    ,    SUM (may11_bld)  AS may11_bld
    ,    SUM (may11_tbld) AS may11_tbld
    ,    CASE
            WHEN  GROUPING (dis) = 0
            THEN  SUM (may11_iptv)
        END      AS may11_iptv   
    FROM    pivot_results
    GROUP BY  ROLLUP (dis)
    ORDER BY  pivot_results.dis
    ;Thank you,

    Hi,
    So you know how to compute iptv for an individual row; the problem now is that you want to get a running total of iptv; is that it?
    The problem there is that computing iptv requires an analytic function, and analytic functions can't be nested. To get the results of nesting f (g (x)), where f and g are analytic funtions, you have to compute g in a sub-query, and then use the results as the argument to f in a super-query.
    Here's how to apply that to your situation:
    WITH  pivot_results  AS
         SELECT    dis
    -- April, 2011
           ,           NVL (apr11_rep,   0)  AS apr11_rep
           ,           NVL (apr11_bld,   0)  AS apr11_bld
           ,           NVL ( SUM (apr11_bld)
                                       OVER (ORDER BY dis DESC)
                          , 0
                          )               AS apr11_tbld
         ,      NVL ( 1000 * apr11_rep
                              / NULLIF ( SUM (apr11_bld) OVER (ORDER BY dis DESC)
                                          , 0
                   , 0
                   )               AS apr11_iptv
    -- May, 2011
           ,           NVL (may11_rep,   0)  AS may11_rep
           ,           NVL (may11_bld,   0)  AS may11_bld
           ,           NVL ( SUM (may11_bld)
                                       OVER (ORDER BY dis DESC)
                          , 0
                          )               AS may11_tbld
         ,      NVL ( 1000 * may11_rep
                              / NULLIF ( SUM (may11_bld) OVER (ORDER BY dis DESC)
                                          , 0
                   , 0
                   )               AS may11_iptv
           FROM     chart_detail
           PIVOT    (    MAX (rplc)  AS rep
                    ,    MAX (bld)   AS bld
                    FOR  bld_mo   IN ( '2011-04'  AS apr11
                                      , '2011-05'  AS may11
    SELECT    CASE
                  WHEN  GROUPING (dis) = 0
                  THEN  TO_CHAR (dis)
                  ELSE  'Total'
               END      AS dis
    -- April 2011
    ,           SUM (apr11_rep)  AS apr11_rep
    ,           SUM (apr11_bld)  AS apr11_bld
    ,           SUM (apr11_tbld) AS apr11_tbld
    ,           CASE
                  WHEN  GROUPING (dis) = 0
                  THEN  ROUND ( SUM (SUM (apr11_iptv))
                                          OVER (ORDER BY  dis)
                      , 2
               END      AS apr11_iptv
    -- May 2011
    ,           SUM (may11_rep)  AS may11_rep
    ,           SUM (may11_bld)  AS may11_bld
    ,           SUM (may11_tbld) AS may11_tbld
    ,           CASE
                  WHEN  GROUPING (dis) = 0
                  THEN  ROUND ( SUM (SUM (may11_iptv))
                                          OVER (ORDER BY  dis)
                      , 2
               END      AS may11_iptv
    FROM      pivot_results
    GROUP BY  ROLLUP (dis)
    ORDER BY  pivot_results.dis
    ;Output:
          APR11  APR11   APR11  APR11 MAY11  MAY11   MAY11  MAY11
    DIS    _REP   _BLD   _TBLD  _IPTV  _REP   _BLD   _TBLD  _IPTV
    30        1      0   37021    .03     0      0   30271    .00
    60        7      0   37021    .22     4      0   30271    .13
    90        9      0   37021    .46     1  24557   30271    .17
    120       5  26449   37021    .59     0   5714    5714    .17
    150       0  10572   10572    .59     0      0       0    .17
    Total    22  37021  158656            5  30271   96527As you can see, this is not quite what you wanted on the row where dis='150'. You asked for NULLS in the may11_rep, may11_bld and may11_iptv columns. You can get those results if you need them; just explain the rules that govern whether to display the values and when to display NULL.
    The way you posted the sample data and results, and the quantity of sample data were all excellent; it really helped me find a solution. Thanks.
    It would have also helped it you had explained how iptv is computed. Basically, iptv = 1000 * rep / tbld, right?
    It looks like most of this code:
    ,      DECODE(NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),0,0,ROUND(NVL(may11_rep, 0)*1000/ NVL ( SUM (may11_bld)
                      OVER (ORDER BY dis DESC)
                    ,                 0),2
                    ))        AS may11_iptvwas a way of avoiding divide by 0 errors; it would have been helpful if you had explained that.

  • Running Total Variation Query Time Optimization

    Hi all, 
    I've been struggling with this query for a while. I need to set a customer specific running total for 10 million rows (reset for every customer). But every time the number goes negative, I need to set it as zero.
    For example,
    member no              amount            wallet
    member1                 400                      400
    member1                 -500                     0
    member1                  200                    200
    member2                  700                    700
    member2                 -200                    500
    Query:
    DECLARE @member float
    DECLARE @prev_member float
    DECLARE @amount float
    DECLARE @wallet float
    DECLARE db_cursor CURSOR FOR  
    SELECT [Member no], [Transaction Amount] 
    FROM [wallet_master_3]
    ORDER BY [Member No], [rownum]
    FOR UPDATE
    OPEN db_cursor
    FETCH NEXT FROM db_cursor INTO @member, @amount
    SET @prev_member = @member
    set @wallet=0
    WHILE @@FETCH_STATUS = 0
    BEGIN   
           IF @prev_member <> @member set @wallet=0
           SET @wallet = @wallet + @amount
           IF @wallet < 0 SET @wallet = 0
           UPDATE [wallet_master_3] SET walletsize = @wallet
           WHERE CURRENT OF db_cursor
           set @prev_member=@member
           FETCH NEXT FROM db_cursor INTO @member, @amount
    END   
    CLOSE db_cursor   
    DEALLOCATE db_cursor
    I've tried using a cursor. In five minutes, it ran 17,000 rows but after running it for 15 hours, the code only manages to set the running total for 175,000 rows. I'm not exactly sure why. Is there a faster approach I can use? 
    Thanks!

    As an exercise a 'Quirky Update' may help you in this scenario. Try the below trick!
    DECLARE @Wallet AS TABLE
    MemberNo VARCHAR(10),
    RowNum INT,
    Amount INT,
    Wallet INT
    INSERT INTO @Wallet (MemberNo, RowNum, Amount) VALUES
    ('member1',1, 400),
    ('member1',2, -500),
    ('member1',3, 200),
    ('member2',1, 700),
    ('member2',2, -200)
    DECLARE @RunTotal AS INT
    UPDATE W1
    SET
    @RunTotal = W1.Wallet =
    CASE
    WHEN W1.RowNum = 1 THEN W1.Amount
    WHEN @RunTotal + COALESCE(W1.Amount, W2.Amount) < 0 THEN 0
    ELSE @RunTotal + COALESCE(W1.Amount, W2.Amount)
    END
    FROM @Wallet W1
    LEFT OUTER JOIN @Wallet W2
    ON W1.MemberNo = W2.MemberNo AND W2.RowNum = W1.RowNum - 1;
    SELECT * FROM @Wallet;
    RESULT
    MemberNo RowNum Amount Wallet
    member1 1 400 400
    member1 2 -500 0
    member1 3 200 200
    member2 1 700 700
    member2 2 -200 500
    You can read more on 'Quirky Update' in below articles
    Solving the Running Total and Ordinal Rank Problems - Jeff Moden
    Robyn Page's SQL Server Cursor Workbench
    NOTE: Please test it thoroughly before using in a production environment!
    Krishnakumar S

  • Cumulative Key Figure (Running Total) - how to use in formula?

    We have a scenario where I need to use the cumulative value of a Key Figure in a subsequent formula. The “Cumulated” property setting at the Key Figure level in the query is a “Displayed Data Only” setting, however, so the cumulated values are not available for use in a formula  The individual values are used by BW as opposed to the cumulative values that are displayed in the column.
    I’ve tried using the “Cumulated” property at the characteristic level. I am then able to use the displayed cumulative values in a formula. However, I also need to display the individual (not cumulated) Key Figure values in a column. These individual values are no longer available for display if the “Cumulated” property is set at the Characteristic level.
    I thought that the “Define Cells” functionality could possible be used, but there is only one Structure in the query, so the “Define Cells” functionality is unavailable. I could not think of a way to use a second structure in the rows, as the rows need to be dynamic (two characteristics, populated based on user input variables).
    It may be possible to accomplish this requirement by adding a column using VBA in the SAPBEXonRefresh sub, but use of VBA is not a preferred option, as the query may be run in either the Excel Analyzer or the Web Analyzer.
    The infoprovider does not contain a Key Figure field for Cumulative Volumes.
    The scenario details:
    Rows (Characteristics):
    A: Plant (values based on user input variable)
    B: Calendar day (values based on user input date variables for start & end dates)
    So there is one row for each day within each plant.
    Columns (Key Figures):
    A: Cumulative Volume at Start of Period (uses user input date variable for start date, and “Constant Value” property. Hidden column.)
    B: Daily Volume (for each day in the period defined by the user input variables for start and end dates)
    C: Cumulative Volume at End of Each Day (formula, meant to be equal to the sum of the Cumulative Volume at start of period plus the total so far of the Daily volumes. In other words, equal to the sum of Column A plus the running total of Column B).
    Does anyone out there have any more ideas on how to accomplish the required Cumulative Volume computation?

    Thanks for your reply Jurgen.
    I've created a Global Calculated Key Figure (CKF), and have looked at and tried a number of settings in the Properties of this new CKF.
    I have not yet been able to make this work for me.
    The "Cumulated" property for a Global CKF is also a display-only property. The displayed running total is not used in any formula containing this CKF, only the individual values are used in the formula.
    If I select the 'Enhance' option, where exception aggregation can be done as I think you suggested, I do not see a 'cumulated' option. If I select the 'Summation' option for 'Exception Aggregation', then the 'Reference Characteristic' pull-down is not available.
    Is there a different 'Exception Aggregation' option I should be using for running totals at the calendar day level?
    Or am I unclear on the concept of your suggestion?
    Perhaps you're on a later version of BW that has more Exception Aggregation options? (We're on BW3.5)

  • Running Total of a Calculated Member

    Hi Friends ,
    Need help  in calculating the Running Total of a calculated member . I am using the below Query to calculate but it is not showing correct Values.
    Query :
    WITH
    set
    [FUNCTIONAL BENEFITS]
    as
    ORDER(
    [FUNCTIONAL BENEFITS].[FUNCTIONAL BENEFITS].children,[Measures].[ANNUAL UNIT CASES WEIGHTED VALUE]
    ,DESC)
    member  AUCWEIGHT as
    [Measures].[ANNUAL UNIT CASES WEIGHTED VALUE],
    FORMAT_STRING='##0.0'
    member
    [Running Total]
    AS
    SUM({null:[FUNCTIONAL BENEFITS].[FUNCTIONAL BENEFITS].CurrentMember},[Measures].[ANNUAL UNIT CASES WEIGHTED VALUE]),
    FORMAT_STRING='##0.0'
    MEMBER [Measures].[AUCWV_PRCT] AS
    ([Running Total]/[Measures].[TotalSuM])*100,
    FORMAT_STRING='##0.0'
    member  [CummalativePercent] as
    (SUM({null:[FUNCTIONAL BENEFITS].[FUNCTIONAL BENEFITS].currentmember},[Measures].[AUCWV_PRCT]))
    SELECT {
    AUCWEIGHT,[Running Total],
    [Measures].[TotalSuM],[Measures].[AUCWV_PRCT],[CummalativePercent]}on columns,
    NON EMPTY ([FUNCTIONAL BENEFITS])
    DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON rows
    FROM [RRMiningDS1_CUBE]
    Output :
    DiMENSION
    AUCWEIGHT
    RunningTotal
    TotalSum
    AUCWV_PRCT 
    CUMMULATIVEPERCENT
    CORRECTCUMMULATIVEPERCENT
    A
    62605.4
    661634.6
    1345632.2
       49.2
    1271.2
    49.2
    B
    38587.9
    425278.7
    1345632.2
       31.6
    545.5
    80.8
    C
    35894.5
    370057.9
    1345632.2 
       27.5
    485.2
    108.3
    D
    30246.4
    48345.3
    1345632.2
       3.6
    4.9
    111.9
    The CUMMALITIVEPERCENT is coming wrong .
    I have mentioned the Correct CummulativePercent. as it should be the Running sum of AUCWV_PRCT i.e
    49.2+31.6+27.5+3.6=111.9
    Please help . where i am making the mistake
    Thanks
    Rakesh k Dhar

    Hi R,
    It might be as simple as adding solve_order = 99 to the cumulative calc. This tells the formula engine to do the cumulative calculation after the %.
    Richard

  • Running total and Next function in Crosstab

    <strong><font size="3"><font face="Times New Roman">Clarifications on getting Next Running sum and count on a Crosstab</font></font></strong><font face="Times New Roman" size="3"> </font> <p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Here is the example, which I am working on:</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Highlights of the Report:</font></p><p style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; tab-stops: list .5in" class="MsoNormal"><font face="Times New Roman"><span><font size="3">-</font><span style="font: 7pt &#39;Times New Roman&#39;">         </span></span><font size="3">Report is grouped on {Scenario Name}</font></font></p><p style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; tab-stops: list .5in" class="MsoNormal"><font face="Times New Roman"><span><font size="3">-</font><span style="font: 7pt &#39;Times New Roman&#39;">         </span></span><font size="3">Left side dates on any of the tables is {Version Date}</font></font></p><p style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; tab-stops: list .5in" class="MsoNormal"><font face="Times New Roman"><span><font size="3">-</font><span style="font: 7pt &#39;Times New Roman&#39;">         </span></span><font size="3">Dates on the top header on any of the tables is {Fsc Week End Dt}</font></font></p><p style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; tab-stops: list .5in" class="MsoNormal"><font face="Times New Roman"><span><font size="3">-</font><span style="font: 7pt &#39;Times New Roman&#39;">         </span></span><font size="3">Other formulae used in this report are:</font></font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">1) = ({Query1.Demand Qty})/100000</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Numerical values displayed in the "Original values" table.</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">2) =</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">if {Query1.Scenario Name} = &#39;DLYPRD:ASCP-PRD:PRD&#39; </font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">THEN mid ({Query1.Scenario Name},13,3)</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">ELSE mid ({Query1.Scenario Name},13,6)</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Second column with value PRD in any of the tables.</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">3) {next qty} = if not onlastrecord then next({@ShortDemandQty}) else 0;</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">(used in the "next values vertically" table)</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">4) - running total to calculate horizontally</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Evaluate - For each record</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Reset - On change of field: {Version Date}</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">5) - running total to calculate vertically.</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Evaluate - For each record</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Reset - On change of field: {Fsc Week End Dt}</font></p><font face="Times New Roman" size="3"> </font> <p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">In this report design, when I go and change the Sort order in the Record Sort Expert, some of the values go for a toss. I got two cases where the vertical values are correct in one case and horizontal values are correct in another case.</font></p><font face="Times New Roman" size="3"> </font><strong><font size="3"><font face="Times New Roman">First Case:</font></font></strong> <p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Cumulative vertical values are correct.</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal">&#160;</p><font face="Times New Roman" size="3"> </font><strong><font size="3"><font face="Times New Roman">Second Case:</font></font></strong> <p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Cumulative horizontal values are correct.</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal">&#160;</p><font face="Times New Roman" size="3"> </font><strong><span style="color: blue"><font size="3"><font face="Times New Roman">Is there any way to consistisize both the horizontal and vertical running totals. I even tried forcing the evaluate & reset like below and clearing the record sort order, but it did not work:</font></font></span></strong><strong><span style="color: blue"><font face="Times New Roman" size="3"> </font></span></strong> <p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">1) - running total to calculate horizontally</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Evaluate - On change of field: {Fsc Week End Dt}</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Reset - On change of field: {Version Date}</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">2) - running total to calculate vertically.</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Evaluate - On change of field: {Version Date}</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">Reset - On change of field: {Fsc Week End Dt}</font></p><font face="Times New Roman" size="3"> </font><strong><span style="color: blue"><font size="3"><font face="Times New Roman">And one more observation on the running total, how it works in the crosstab is, the total runs likes a spiral rather than resetting at the column or row level. Is there any way to restrict this?</font></font></span></strong><font face="Times New Roman" size="3"> </font> <p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">3) {next qty} = if not onlastrecord then next({@ShortDemandQty}) else 0;</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">(used in the "next values vertically" table)</font></p><font face="Times New Roman" size="3"> </font> <p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">For example, onlastrecord does not seem to work on the "next values vertically" crosstab, rather brings the record from the next column.</font></p><p style="margin: 0in 0in 0pt" class="MsoNormal"><font face="Times New Roman" size="3">For 3/7/2007 - 01/APR/07, the value is 157.84 which is incorrect and should be 0.</font></p><strong><span style="color: blue"><font size="3"><font face="Times New Roman">I need to get a next on the running total. Next (fld) doesnot work for running totals. Please guide me, how to get the next values for the running total fields.</font></font></span></strong>

    Post Author: redtop6683
    CA Forum: Formula
    Whoops I guess I should have mentioned that I've already tried using Sum and Round(Running Total, 2) and haven't had any luck.
    I also should have mentioned that Groupings 1 and 2 are sums, and that Running Total is a running total that changes on every change of the grouping.  There are 4 groupings.
    Grouping 1 (Employee Name)
    Grouping 1.1 (Shift)
    Grouping 1.2.1 (Payroll Department Code)
    Grouping 1.2.1.1 (Description)
    Below these 4 groupings is where the running total is.  The issue is that in the footer of grouping 1 is a field that sums the elapsed hours for the particular employee by each payroll department code, these are then summed using the running total.  The issue is as stated in the earler post that I can round these individual sums on the groupings, but I get the number on my running total to round differently as you can see by the earlier post's example.
    Thanks for the help.
    ~Jason

  • Running total of another running total ( or some other solution )

    I posted in my previous thread that I would like to be able to do rounding at the subtotal level and then have a total of these subtotals.  Here is the original thread:
    totals in a cross tab report
    So I was told that with the cross-tab report I can either do rounding at the details level or at the final total level.  However, I need to be able to do the following:
    Suppose I receive payments from different states.  In my report I would like to be able to display:
    - a total of all payments for one given state, rounded to whole dollars - this one is easy because I just create a running total for the payments and then at the end I round it to whole dollars
    - a total of all payments and all states as one number.  However, the problem I can't figure out here is that this grand total needs to be calculated as the SUM of the totals for each state where the total for each state is rounded to a whole dollar before being added to the grand total.  So the rounding should not be done on the final grand total but rather:
    1. calculate the total of payments for one state and round it to a whole dollar - let's call it StateTotal ( rounded)
    2. calculate the SUM of all StateTotal values.  So it needs to be a SUM of the already rounded state totals.
    Any help will be greatly appreciated.
    thanks

    hello all,
    if you want to use a manual running total then that is okay. you don't actually put the manual running total in the cross-tab expert though as you will get a print time error.
    you use the "Display String" formula dialogue on an existing cross-tab summary to do the manual running total in.
    have a look at the attached sample...there are 2 manual running totals in there...one that goes horizontally (across the columns) and one that goes vertically (down the rows).
    there is also a Xtab Info column that is there just to show you how the manual running total counter variables are incremented through the cross-tab. in crystal reports 2008 there are a lot of new cross-tab functions that are different from this but that is a completely different topic.
    i hope this helps,
    jamie

  • Cumulative Balance Running Total

    Hello community,
    i am doing a business partner Account balance report, i have already successfully fetch my data in to crystal reports as well as the running total for the cumulative balance, my problem is i have a duplicated rows in debit side, now how will i say to crystal reports (in Formula expression) that the 1st line if duplicated will the only one to be evaluated. for more detail please see image below
    http://i264.photobucket.com/albums/ii184/abing430/CRDuplicatedRows.png
    http://i264.photobucket.com/albums/ii184/abing430/CRDuplicatedRows-1.png
    please help.
    best regards,
    Fidel

    hello sharonamt,
    thanks for the response.
    //Head
    Shared NumberVar OB := {Command.Open Balance}
    //Line
    shared numbervar OB;
    OB := OB + {BP_AccountBalance;1.Credit} - {BP_AccountBalance;1.Debit}
    //Footer
    Shared numbervar OB
    i have this ff. formula the header is put in the page header, the line is put ing Group Footer section and the footer is put in report footer section. my group is grouped by Ref field w/c is unique in this report.
    the duplicated rows is eliminated since i put my line formula in the group footer. but using the ff. formula's the report is ok, the results is fine on the first page only, because in the second page it will get the OB balance which is in the page header of the report., i dont needt to reset my running total.
    thanks.
    please help
    best regards.
    EDIT:
    i have manage to figure out my problem... i just use this formula and it works.
    whileprintingrecords;
    if pagenumber = 1 then Shared NumberVar OB := {OpeningBalance.Open Balance}
    else
    0
    since im having problem with reseting of the openingbalance, i had trap the page numvber and never reset the running total. this formula works for me as of now.
    Fidel
    Edited by: Avelino Fidel on Jan 24, 2011 2:46 PM

  • Running Total for "cleared balance"

    I want to produce query that will produce two running totals. The 1st once is straight forward and is 'Ledger Balance' - that is the balance after a particular transaction has taken place on that day. The Cleared Balance is the running total balance accounting for the value date of a transaction. For example a transaction for today, say $50 may be value dated tomorrow and hence is included in the Ledger Balance but would not appear in the Cleared balance until tomorrow.
    Lets try and use some simple data:
    TransactionsTable                    
    Tran_ID     TranDate     ValueDate     Amount
    1     01/02/2004     01/02/2004     50
    2     01/02/2004     01/02/2004     25
    3     01/02/2004     05/02/2004     30
    4     01/02/2004     01/02/2004     55
    5     02/02/2004     04/02/2004     11
    6     02/02/2004     02/02/2004     23
    7     02/02/2004     02/02/2004     33
    8     02/02/2004     02/02/2004     47
    9     04/02/2004     04/02/2004     10
    10     07/02/2004     07/02/2004     5
    StatementHistory                    
    AC_No     Start_Date     End_Date     Opening_Ledger     Opening_Cleared
    55     02/02/2004     02/02/2004     160          130
    55     04/03/2004     04/02/2004     274          233
    Assuming that the account opened on the 01/02/04 with a zero balance.
    So for a daily statement on the 01/02/04, I'd expect to see the following Details     
    TranDate     ValueDate     Amount     Ledger Balance     Cleared Balance
    01/02/2004     01/02/2004     50     50          50
    01/02/2004     01/02/2004     25     75          75
    01/02/2004     05/02/2004     30     105          75
    01/02/2004     01/02/2004     55     160          130
    So for a daily statement on the 02/02/04, I'd expect to see the following Details
    TranDate     ValueDate     Amount     Ledger Balance     Cleared Balance
    02/02/2004     04/02/2004     11     171          130
    02/02/2004     02/02/2004     23     194          153
    02/02/2004     02/02/2004     33     227          186
    02/02/2004     02/02/2004     47     274          233
    And skipping to the 04/02/04, I'd expect to see.
    04/02/2004     04/02/2004     10     284          254
    I can get the ledger balance using:
              sum(amount_to_account) OVER (PARTITION BY ac_no , trans_ID
              ORDER BY TranDate, trans_ID
              RANGE UNBOUNDED PRECEDING)
         + sh.Opening_Ledger
    But I'm unsure how to get the Cleared balance as this need to access transaction inforation from a number of days previous (possibly up to 5 days allowing for maximum period for clearing a transaction).
    Does anyone have an idea how to achive this?

    Hi,
    Try this:
    WITH A AS
    select 1 col1,  'A' col2, 2 col3  from dual union all
    select 1 col1,  'A' col2, 2 col3  from dual union all
    select 1 col1,  'A' col2, 2 col3  from dual union all
    select 1 col1,  'B' col2, 3 col3  from dual union all
    select 1 col1,  'B' col2, 3 col3  from dual union all
    select 1 col1,  'C' col2, 5 col3  from dual union all
    select 1 col1,  'D' col2, 2 col3  from dual union all
    select 1 col1,  'D' col2, 2 col3  from dual
    ,B AS
    SELECT
      A.*
      ,ROW_NUMBER() OVER (PARTITION BY COL1, COL2 ORDER BY 1) RN
    FROM
      A
    SELECT
      B.*
      ,SUM(CASE WHEN RN = 1 THEN COL3 ELSE 0 END) OVER ( ORDER BY COL1, COL2 ,RN ) cumulative_tot
    FROM
      B
    COL1 COL2 COL3 RN CUMULATIVE_TOT
       1 A       2  1              2
       1 A       2  2              2
       1 A       2  3              2
       1 B       3  1              5
       1 B       3  2              5
       1 C       5  1             10
       1 D       2  1             12
       1 D       2  2             12
    8 rows selected Regards,
    Peter

Maybe you are looking for

  • Facebook video chat compatibility in window 8.1

    Please note that I can't able to find facebook video chat icon in window 8.1 operating system. Same has been available in window 7 and lover version. Please note that I was use same logging and I found this mismatch. Request you to please provide sol

  • How to access a variable from inside another symbol

    So i did this tutorial, Leveraging Independent Symbol Timelines created by Eliane...it's rockin, btw.  ;-) All's well but now i have a symbol on the stage called mc-home.  inside of mc-home is a button called btn-go. On the stage in composition ready

  • Timezone issue

    Hi, I am based in Sydney, Australia and have the database with APEX runing here and Database timezone set to AEST (Australian Eastern Standard Time). Now, In one of the fields in my form, which links to a timestamp with local timezone column, 23/11/2

  • Display with alv

    pls help on this i declared one internal table with types. types: begin of <name>,        field        end of <name>. data: <name1> like standard table<name> with header line. all retrived data i stored in <name1> internal table(contains about 74 fie

  • Strange position and size when QT opens

    I'm a Windows user. My Canon Ixus 220 HS digicam has a neat 1920x1080 movie capability. It creates files in MOV format. But when I play these on my Windows XP PC, QT always opens offset down and right (100,100) and at a size of 1936 x 1205, which is