Calculate sales Accumalated

Hello world

Could someone suggest me how to calculate total sales. The scenario is

My Table is like this

Cardno sales accumulated sales
101 100 100
102 80 180
103 20 200


I need to calculate the third column "Accumulated Sales" from column 2 "sales".

is there a formula in oracle to calculate cumulative sales? How did I need form the SQL for this requirement? Can anyone help?

Thanks in advance

Concerning
select
Cardno,
 Sales,
 sum(Sales) over(order by rownum) as "Accumulated Sales"
from your_table

Tags: Database

Similar Questions

  • R12.1.3 GOOSE costs transferred to AP reports are not automatically calculated tax

    Hello Experts,

    We lack Oracle Internet charge on r12.1.3.

    Current process of the customer: -.

    1. employees create reports on expenditures. Auditors must manually add the code for the VAT on each expense report. When transferred to AP using report Export charges, the Bills have already created tax lines. The system self-generating lines of tax based on the code of the VAT is passed GOOSE.

    Desired process: -.

    2. employees create reports on expenditures. System by default, code VAT based on the type of expense. Transferred to the AP using report Export charges, invoices should have already created tax lines. The system should automatically generate the lines of tax based on the code of the VAT is passed GOOSE.

    The question: -.

    3. Although the VAT code to pass through for AP of the OIE, no tax is calculated automatically. The user must open each invoice and press the calculate tax. Then the system calculates tax and creates a tax line. This is the gap.

    Can someone help me understand if're missing us a setting somewhere? Why is the system stops automatically generate tax lines when the tax code is set by default to the type of expense?

    Thanks for your help.

    Concerning

    vhaqa.

    Hi Vhaqa,

    The tax lines are created automatically when you post the invoice. Have you tried running the validation process rather than having to manually open each report costs and click on the button "calculate sales tax?

    Cheryl

  • JavaScript subject minimum hourly - Please HELP!

    Hello, I'm trying to figure out a JavaScript which will automatically calculate sales tax but will result in a minimum fee.

    Here is an example:

    I have the total cost of the project (once) le.008 figured out field, but would like to go a little further and when the number is less than $50, then $50 appears in the last field. When the number is more than $50, then the number indicates. Example would be the project $10000 will automatically calculate and display $80.

    Someone knows how to do a quick javascript for this scenario?

    Thank you

    Patrick

    Of course, it will be something like this (you may need to adjust the domain names concerned):

    var result = Number(this.getField("total project cost").value) * 0.008;
    event.value = Math.max(50, result);
    
  • Calculation javascript in Acrobat Pro XI

    Good,

    I need help in writing a javascript script to calculate sales tax in an acrobat form.

    I want the value of the "Taxe_Ventes" classified as "0.00" unless the value of the field "Customer_State" is "WILL", so I want to be "Subtotal" value of "Sales_Tax" * 0,053.

    Can someone help me with this? I don't know javascript, and google isn't helping a young girl.

    Thanks in advance!

    Use what the calculation script personalized of Taxe_Ventes:

    var state = this.getField("Customer_State").value;
    var subtotal = Number(this.getField("Subtotal").value);
    if (state=="VA") event.value = subtotal * 0.053;
    else event.value = 0;
    
  • Interactive form with the issue of personal calculation

    Hello, I'm new to javascript and met with a coding problem.  I have an interactive pdf file it is a purchase order in bulk.  The form calculates the subtotal.  My form has to calculate sales tax (0.05%), if a resident of Hawaii.  I created a radio button with a Yes or no answer.  The Yes option button exports as a de.005 value.  The answer didn't export the value 0. I know that I mean if the value of 'taxyn' est.005 and then multiply by "Subtotal".  If the value of 'taxyn' is 0 then put 0.   I use the script in the section below custom calculations.  The result is that ' yes' or 'no' radio button the response always calculates the tax.  What Miss me?

    the value at 0.05% tax rate

    var tax_rate = 0.005;

    Get the value of the option button

    taxable var = getField("taxyn").value;

    Get the value of the subtotal field

    Subtotal var = getField("subtotal").value;

    Set this field value

    If (taxable! == 'Off') {}

    Subtotal = Event.Value * tax_rate;

    } else {}

    Event.Value = "";

    }

    Thank you in advance!

    Melissa

    You have entered "totqty" as a field in its own calculations

    script... So, whenever the value is updated, it adds its own value to

    himself. That is why he continues to expand whenever you make a change to the

    option buttons.

  • What is the best way to measure the size in InDesign?

    Hi all

    I'm doing an analysis of PSI on a retail catalog.

    To do this, you measure the area of a product and support copy fit on a page, and then calculate sales revenue, etc. to find your books/po2.

    Now, I am aware Acrobat has a "Measurement area" tool, but because of bugs or bad programming it simply does not work on my retina Macbook Pro (Pro XI) and culminates at the CPU just drawing lines.

    Yes, is there any designer catalog here that has a solution, uses a software plugin or script or third parties to measure the space?

    Thank you

    Hello

    There is a discussion about a script here.

    http://forums.Adobe.com/message/2619606#2619606

    There is also a free script here.

    http://www.Kerntiff.co.uk/free-stuff/areatool

    P.

  • Taxes and prices of attribute code

    I need some clarification.

    A customer has a catalogue, in which, many of its problems are sold in 3 sizes, each with their own prices AND quantities. To simplify things, we have created 3 sizes product as product attributes. I linked the catalogue below.

    http://sweetsandtreatsboutique.2121customcontact.com/sweets-treats-product-catalog/cupcake-Rev clothing

    In addition to their price, we must charge tax to the Louisiana purchase. However, after reading several tutorials and forums here in British Colombia, I discovered that we cannot have prices of sale and prices of the attribute. (BC added two awards). This creates a problem. The tax code for the product (which should be 8.5%) does not appear in the shopping cart. My import file list properly the code of taxes for items, but when I check BC under the list of products, he said that no tax is applied. I am correct that a sale price must be present in British Colombia calculate sales tax?

    How can I get the tax code to apply to the attribute price without having to go through all the items, then select the appropriate tax code manully?

    If we weren't on such a tight schedule, I would keep on looking, but our time is limited.

    -Chuck

    I think I can have thought of it. I put the sale price at zero (0). This activates the tax code and no matter what price in attributes are charged at the rate of tax.

  • How to calculate the percentage of monthly sales

    Hello

    I have a column sales of the month and I have another column that calculates (monthly sales / (total number of monthly sales)) * 100.

    How to calculate this percentage of sales.

    Please advice.

    Kind regards

    Séverine.

    You can use the AGGREGATE function for the TOTAL monthly sales in the year:

    Something like: AGGREGATE ("measure monthly sales" to "Time" ".") Time hierarchy ".» An »)

    Calculate your final formula:

    "measure the monthly sales" / AGGREGATE ("measure monthly sale 'to"time'." Time hierarchy ".» Year') * 100

  • How to calculate the top 100 in analytical report of obiee 11g?

    Hello

    I am creting report Analytics obiee 11g.

    I plug 5 columns, balance, status of the loan, district loantype.

    I want to display the data from the highest of 5 columns in the analytical report...

    For this report, I would like to add customized lines...

    My requiremt, I want to show the top 100 sales, the total amount outstanding

    and I want to add personal calculation as (total of balances / top 100 outstanding balance) * 100

    Please help me,

    I tried, I don't get.

    Please help me, how calculate these?...

    Thank you and best regards,

    A.Kavya

    Hello Kayva,

    First of all, must be defined, the grade you want, ask yourself, if you want to rank by period, branch etc, so you must use "RANK (according TO SIZE).

    I made a sample with the similar columns you use, please give.

    I've done 4 criteria using 'UNION' (not 'UNION ALL', not 'INTERSTECT', 'LESS'):

    And my results are:

    Check it out:

    1st test:-J' have the sum 187 157 538.57 as the sum of the top 10 projects, the Company (Empresa) and period (Mesanodocum)

    2dont criteria: -check the second line "SumaTotalProyectos" which is the sum total of society in Ene-2015 (January 2015) for all projects. Who is 211 249 318,42

    3 criteria:-check the 187 157 538.57 which is the sum of the top 10 projects

    4 criteria: -which is the percentage of it, 187 157 538.57 / 211 249 318,42 = 88.60%

    How can you put?

    1. allows you to check the criteria 1: the sum of the top 10 projects

    Check the filter of RANK

    2 to check the 2 criteria: total sum of society

    3 to check the 3 criteria: ranking of the sum

    4 to ensure criteria 4: percentage

    Note:

    As you can see I have two projects "columns", I need to get the sum of ranking, for example, you must do a ranking by branch and get the same, has twice this column to your criteria and after it allowed you to exclude.

    Kind regards

  • sales and application analytics

    Hello experts.

    I have queries below are examples of data below. I want to determine the sales of two albums for each week. I started working on it using row_number, but I do not get the required result

    with t as

    (

    Select "week 1" as r_week, 'John' as r_name, 100 sales, "NY" as a place of the double ".

    Union of all the

    Select "week 1" as r_week, "Chris" as r_name, 20 sales, "TX" as the place of the double ".

    Union of all the

    Select "week 1"as r_week, "Melissa" as r_name, 80 as sales, "GO" as a double.

    Union of all the

    Select "week 2" as r_week, "Katy" as r_name, 40 sales, 'SC' as a double ".

    Union of all the

    Select "week 2" as r_week, 'Angle' as r_name, 10 sales, "NC" as the place of the double ".

    Union of all the

    Select ' week 2' as r_week, "Vick" as r_name, 30 sales, 'CA' as a double.

    Union of all the

    Select "3 week" as r_week, "Zack" as r_name, 60 as sales, 'CA' as a double ".

    Union of all the

    Select "3 week" as r_week, "Deb" as r_name, 60 as sales, 'NM' as a double ".

    Union of all the

    Select '3 week "as r_week,"Anthony"as r_name, 60 sales,"TX"as the place of the double '.

    )

    Select r_week, r_name, sales, location, row_number() over (partition r_week, sales by sales): the nurse

    t;

    Hello

    user13328581 wrote:

    Hello experts.

    I have queries below are examples of data below. I want to determine the sales of two albums for each week. I started working on it using row_number, but I do not get the required result

    with t as

    (

    Select "week 1" as r_week, 'John' as r_name, 100 sales, "NY" as a place of the double ".

    Union of all the

    Select "week 1" as r_week, "Chris" as r_name, 20 sales, "TX" as the place of the double ".

    Union of all the

    Select "week 1"as r_week, "Melissa" as r_name, 80 as sales, "GO" as a double.

    Union of all the

    Select "week 2" as r_week, "Katy" as r_name, 40 sales, 'SC' as a double ".

    Union of all the

    Select "week 2" as r_week, 'Angle' as r_name, 10 sales, "NC" as the place of the double ".

    Union of all the

    Select ' week 2' as r_week, "Vick" as r_name, 30 sales, 'CA' as a double.

    Union of all the

    Select "3 week" as r_week, "Zack" as r_name, 60 as sales, 'CA' as a double ".

    Union of all the

    Select "3 week" as r_week, "Deb" as r_name, 60 as sales, 'NM' as a double ".

    Union of all the

    Select '3 week "as r_week,"Anthony"as r_name, 60 sales,"TX"as the place of the double '.

    )

    Select r_week, r_name, sales, location, row_number() over (partition r_week, sales by sales): the nurse

    t;

    Thanks for the display of the data of the sample; It's very useful!

    Don't forget to post the exact results you want from the data of the given sample.  Is that what you want?

    R_WEEK R_NAME SALES PL

    ------ ------- ------- --

    Week 1 John 100 NY

    Week 1 Melissa 80 WILL

    Week 2 Katy 40 SC

    Week 2 Vick 30 CA

    Week 3 Zack 60 CA

    Week 3 Deb 60 NM

    Here's a way to get these results:

    WITH got_rn AS

    (

    SELECT the location, sales, r_name, r_week

    , ROW_NUMBER () OVER (DIVIDE BY r_week - or maybe RANK and DENSE_RANK)

    ORDER BY sales DESC

    ), Rn

    T

    )

    SELECT r_week, r_name, sales, location - or * if you want to view rn

    OF got_rn

    WHERE the rn<=>

    ORDER BY r_week, rn - or what you want

    ;

    You will notice that the subquery got_rn very similar to what you posted.

    If you want a separate for each r_week ranking, then you want to PARTITION BY r_week and nothing else.  (In fact, it seems logic PARTITION BY and ORDER BY the same column in the same function.)  Why?  Discuss among you).

    By default, ORDER BY sorts things in ascending order.  In this case, you are interested in the highest, not the lowest, so specify DESCending order.

    Like all other analytical functions, ROW_NUMBER is calculated after the clause WHERE has been applied.  If you want to use the results of an analytic function in a WHERE clause, calculate the function in a subquery (such as the got_rn above); You can then use the calculated value in the WHERE clause (or anywhere else you want) in a Super application.

    What do you do in the event of a tie?  For example, in your sample data, there is a tie of 3 lanes for the 2 highest ranks in the ' week 3'. "  The query above shows never more than 2 lines for the same r_week.  When there are equal, if you want to show to all competitors for the first 2 places, then use the RANK rather than ROW_NUMBER.

    Depending on what you mean by "the top 2 Sales", you can use DENSE_RANK rather than ROW_NUMBER.

  • need to sum all the sal

    My dear

    This query, I know sal sum in dept by job is

    I have to add new coumn in sum to give query for all dept

    and new line give sum for each Department

    as a matrix report

    WITH pivot_data AS (SELECT deptno, job, sal FROM emp)

    SELECT "JOB."

    "10."

    "20."

    '30 ',.

    "40".

    OF pivot_data PIVOT (SUM (sal)

    FOR deptno

    (10, 20, 30, 40)

    )

    Hello

    So, besides the total sal for each combination of deptno and job, you want also totals for each jdeptno (regardless of the job) and work (regardless of deptno) and a total general (no matter the deptno and employment).  This sounds like a job for the CUBE.  The following soLution uses the CUBE to calculate amounts and then uses the PIVOT just to combine lines.

    WITH all_jobs AS

    (

    SELECT DISTINCT job

    FROM scott.emp

    )

    data_to_pivot AS

    (

    SELECT deptno NVL (d.deptno, - 1)

    , NVL (j.job, 'ALL') AS job

    , NVL (SUM (e.sal), 0) AS sal

    GROUPING (j.job) AS job_agg

    OF scott.dept d

    CROSS JOIN all_jobs j

    LEFT OUTER JOIN scott.emp e ON e.deptno = d.deptno

    AND e.job = j.job

    GROUP BY CUBE (d.deptno, j.job)

    )

    Simply SELECT employment, '10', all_depts '20', '30', '40', - or everything *, if you don't mind saw job_agg

    OF data_to_pivot

    PIVOT (MIN (sal)

    TO deptno IN (10, 20, 30, 40

    All_depts AS-1

    )

    )

    ORDER BY job_agg

    work

    ;

    Output:

    ALL_DEPTS 10 20 30 40 JOB

    --------- ----- ----- ----- ----- ---------

    0 6000 0 0 6000 ANALYST

    1300 1900 950 0 4150 CLERK

    MANAGER OF 2450 2975 2850 0 8275

    THE PRESIDENT 5000 0 0 0 5000

    0 0 5600 0 5600 SELLER

    ALL THE 8750 10875 9400 0 29025

    Instead of deriving a "table" of all possible jobs, you should be able to use a partitioned outer join, something like this:

    WITH pivot_data AS

    (

    SELECT deptno NVL (d.deptno, - 1)

    , NVL (e.job, 'ALL') AS job

    , NVL (SUM (e.sal), 0) AS sal

    GROUPING (employment) AS job_agg

    OF scott.dept d

    LEFT OUTER JOIN scott.emp e PARTITION BY (e.job)

    ON e.deptno = d.deptno

    GROUP BY CUBE (e.job, d.deptno)

    )

    SELECT *.

    OF pivot_data

    PIVOT (MIN (sal)

    TO deptno IN (10, 20, 30, 40

    All_depts AS-1

    )

    )

    ORDER BY job_agg, job

    ;

    But the only effect of the outer join partitioned seems to cause CUBE to abandon some Super aggregates.  I do something ridiculous in this second request, or there is a bug in my version (11.2.0.2.0 Express).

    (Almost always, when people say "there must be a bug", they're just doing something stupid.)  There is no reason to think that I am an exception.  I don't have another version of Oracle at hand right now)

  • How to display the sales forecasts and Simulated_Forecast?

    Hello

    I have this table how can I get the values of 2014_Forecast and Simulated_2014 by using the Least_Square_Regresion or REGR_SLOPE function for a period of 3 months.

    TRANSACTION_TYPEMONTHYEAR_2012YEAR_20132014_ForecastSimulated_2014
    Sales01-18.74-38.00
    Sales02-19.60-34.09
    Sales03-20.20-33.10
    Sales04-19.96-32.21
    Sales05-23.13-29.63
    Sales06-23.88-28.46
    Sales07-30.11-43.89
    Sales08-33.69-35.97
    Sales09-32.65-29.57
    Sales10-37.22-28.18
    Sales11-37.15-31.63
    Sales12-41.70-32.76

    Thanks in advance for your help

    Regards¨

    Carlos

    Why you don't store the DATE as DATE data type data types?

    Before you can use REGR_ *, you will need to set your data model.

    Quick fix:

    alter table sales_unpivoted
      add ( a_date as (trunc( to_date( "YEAR" || "MONTH", 'YYYYMM'), 'MONTH' )));
    

    From there:

    • use a static reference point and the MONTHS_BETWEEN() function to convert the DATE NUMBER (which is REGR_ * what)
    • Use ADD_MONTHS() to convert a DATE

    This example uses all values in SALES_UNPIVOTED to solve y = m * x + b

    with prediction_results as (
      -- find the solution to the curve y = m*x + b
      select transaction_type
        ,regr_slope( amount, months_between( a_date, to_date('201201','YYYYMM')) ) as M
        ,regr_intercept( amount, months_between( a_date, to_date('201201','YYYYMM')) ) B
      from sales_unpivoted
      group by transaction_type
    ), x_generator as ( -- we need a "data set" representing the "x" values
      select level - 1 as x
        from dual connect by level < 12 * 4
    ), prediction_generator as ( -- calculate our "predicted values"
      select P.transaction_type
        ,add_months(to_date('201201','YYYYMM'),X.x) as a_date
        ,P.M * X.x + P.b as predicted_amount -- y = m*x + b
      from prediction_results P, x_generator X
    )
    -- join everything together
    select U.transaction_type, G.a_date, U.amount, G.predicted_amount
      ,months_between( G.a_date, to_date('201201','YYYYMM'))
        as x_axis
    from sales_unpivoted U
    right outer join prediction_generator G
      on (U.a_date = G.a_date and U.transaction_type=G.transaction_type)
    order by G.a_date;
    

    Three month avg, etc. is just a classic analysis with windowing clause.

    MK

  • Example to calculate the average of gemFire

    Yogesh Mahajan,

    I was browsing through your http://community.gemstone.com/display/gemfire60/Data+aware+behavior+routingpage.

    It has a link to an example explaining how to calculate the average sales.

    This link is not navigable. Could you please share the example.

    Thank you

    Hi Neeraj,

    Sorry for the inconvinince, if you look at the child pages, you will get all the examples:

    http://community.gemstone.com/display/gemfire60/function+for+OLTP+applications

    This one is to calculate avg: http://community.gemstone.com/display/gemfire60/Data+independent+parallel+execution+on+all+data+nodes

    I hope this helps.

    Yogesh

  • column of blocks of user_tables account blocks Sales?

    I guess it counts Sales blocks, otherwise it is impossible to calculate the unused space of sale for tables. What do you think?

    Note: I asked this question because one of the users in this forum says

    Blocks (dba_Segments) - Total number of blocks

    Blocks (dba_tables) - number of current used blocks. This does not count the blocks Sales.

    Empty_blocks - blocks ' NEVER USED ' . New blank blocks.

    So if you delete something from the table, these blocks will be marked Sales but will not count in 'blocks' of user_tables. But those also don't count in 'empty_blocks' because they are already served, and now they are dirty.

    Thanks in advance.

    NightWing wrote:

    Column of blocks in user_blocks therefore, count all the blocks used and dirty right?

    As a result, the guy who says that this column of blocks does not count the dirty block is just misleaded?

    Thank you

    After SQL & results which shows the number of blocks both clean & dirty.

  • price is not calculated by process sales order API

    All, I am trying to create a sales order by using the API to process control.
    For some reason, its settlement not online price accordingly I am not able to book.
    I'm defining the price indicator to calculate 'Y '. The price is not filled yet.

    Here is the code for the line:

    l_in_line_tbl (1): = oe_order_pub.g_miss_line_rec;
    l_in_line_tbl (1) .inventory_item_id: = '162744';
    l_in_line_tbl (1) .ordered_quantity: = 1;
    l_in_line_tbl (1) .ship_from_org_id: = 207;
    l_in_line_tbl (1) .orig_sys_document_ref: = "NB_HEADER_2";
    l_in_line_tbl (1) .orig_sys_line_ref: = "NB_LINE_2";
    l_in_line_tbl (1) .operation: = oe_globals.g_opr_create;
    l_in_line_tbl (1) .calculate_price_flag: = 'Y ';

    It works fine when I create manually!
    Can someone please tell me what I'm doing wrong?

    Published by: 918553 on October 23, 2012 14:18

    Date of arrival:

    (1) if there is already a list of prices to be missing in the configuration of the customer of the Type of transaction parameters. Otherwise, you may need to pass a list of price/list_header_id.
    (2) if the unit of MEASUREMENT on the price list is different than the unit of MEASUREMENT in the article master configured

    Dip

Maybe you are looking for