To get the TOTAL at the top

I have a report spec. for which I have to write a SQL query which should print the total aggregate at the top.
For ex. For Dept 10 which has salaries 1000,2000,3000
Deptno Salary
10 Total of Sal for dept 10
     1000
     2000
     3000
20 Total of Sal for Dept 20
Total Final Total (individual grouping totals)
Please suggest the SQL for getting individual totals at the top
Regards,
Gaurav Srivastava

select decode(grouping(empno), 1, decode(grouping(deptno), 1, 'TOTAL', to_char(deptno))) DEPT,  sum(sal) sal
from emp
group by grouping sets ((deptno, empno),(deptno), ())
order by emp.deptno, grouping(emp.empno) desc;
DEPT         SAL
10          8750
            2450
            5000
            1300
20         10875
             800
            2975
            3000
            1100
            3000
30          9400
             950
            1600
            1250
            1250
            2850
            1500
TOTAL      29025

Similar Messages

  • How to display the total at the end of the column in the report.

    Hi all,
    Could any one please intimate, how to display the total at the end of the column. For example, i have a column, "sales" as the Key figure, and it has the data for all the transactions. Now, i would like to display the total at the end of the report, below the same column.
    Similarly, for all the other columns in the report, i need to display the total for all the columns in the report.
    Thanks & Regards,
    A.V.N.Rao

    Hi All,
    Thanks for many suggestions. I tried by providing the "Total" under "Calculate Results as" and also "Counter for all detailed values" under "Calcuate Single Values as", in the  "Calculations" tab of the key figure, but i am unable to get the information. Again, i am providing the requirement below:
    CHAR - A   CHAR - B   TIME CH. - 1 KF -1  KF- 2 KF - 3
    1                     RAM        2012           1         50      50
    2                     SAM         2012          2         100    200
    Result                                               3           150   250
    Assume KF -1 as  "Qty." KF-2  as "Price" KF-3 as "Sales".
    Please intimate the solution.
    Thanks & Regards,
    A.V.N.Rao.

  • Showing the total in the alv

    Hi,
    I have an ALV that I have displayed in a view , the ALV contains few columns , I want to show the total of the fields. Please suggest how to do it.

    hi
    have a look at following [article|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/4063c42a-2549-2c10-fab6-a8c99d98b9b5]
    might help you.
    regards
    manas dua

  • Hi, im using itunes store and i bought some songs and, apple send me a receipt, and it says that its bill to : store credit, and the total of the oder is 1.98 $. so do i have to pay it, or what ?

    Hi, im using itunes store and i bought some songs and apple send me a email, and it says it was a receipt. It also said that its bill to : Store credit, and the total of the order is 1.98 $. So do i have to pay this or its just a proove of purchase ?

    Launch iTunes. From the menu bar click Store / View My Account
    Click: Edit Payment Information
    Make sure you have the correct Security Code.
    Then click: Done
    And try resetting your Apple ID password.  https://iforgot.apple.com/cgi-bin/WebObjects/DSiForgot.woa/wa

  • Add opening balance and transactions in the total of the general ledger

    How can we add all the opening balances and all the transactions of each vendor in the total of the general ledger in SAP Business One 2005 PL45 when we select several vendors ?
    At first sight, there is no system variable in SBO 2005 for this.
    Thierry.

    Hi
    What is your selection criteria:
    At the bottom , there is an option --Sort and summary
    Sort by posting only ;
    Sort by -BPCode ... Summary(yes)
    This should help you
    Bishal

  • Deleting the totals in the view

    Hi,
    Is there any way to eliminate the totals in the demand planning view? How could it be done?
    Thanks a lot

    Sorry , replied with wrong content
    Message was edited by:
            Jan Pasha

  • How can I autofill the "Amount" field in my eCommerce form using the "Total" from the shopping cart?

    I've found the tags to display the shopping cart summary elsewhere on the site, so I know there's a way to display the total, but I can't figure out a way to fill in the required "Amount" field in the eCommerce form used to process payments. I'd like that "Amount" field to be filled in automatically using the total in the shopping cart. Can anyone help? Thanks!

    You can use the shopping cart summary tag with custom layout.
    Here's the sample:
    <input type="text" value="{module_shoppingcartsummary template="/ModuleTemplates/Shop/cartsummary.tpl"}">
    Inside the shopping cart summary custom layout is a tag for total amount:
    {tag_currency}{tag_totalAmount} or {tag_totalAmountWithCurrency}

  • Why resource cost in Oracle does not equal the total on the routing of Usage.

    why resource cost in Oracle does not equal the total on the routing of Usage.

    Hi Judy,
    I could not reproduce your issue. Is your Project Server patched with the latest SP and CU?
    Also can you reproduce this unexpected behavior with another project?
    Can you split your screen from the resource usage view, display the resource form and click right on the grey part selecting "schedule"? Then you'll have the scheduled start and finish dates for the resource's assignments. This is to be sure that
    you are not missing any parts of the assignments due to a wrong zoom in the timephased grid.
    Hope this helps,
    Guillaume Rouyre, MBA, MCP, MCTS |

  • To get a total of the column

    Hi, is possible to get a total of a column that have a date ('HH24:MI:SS') format, in a REPORT?
    Because I try with the option SUM of the attributes of the region but doesn't work.
    Thank!

    I think you have to do this manually. See my post from today talking on the leading total:
    How to display TOTAL before the rows ?
    Denes Kubicek

  • Get Grand total of the subtotals

    Hi,
    I am devoloping a report which pulls the expense lines for each project.I am displaying the fte count at each line.As it'll be same for a particular project,all the lines for that particular project will show the same FTE count.I am grouping the
    lines by Project No in Desktop edition.Now I want the total fte count which is the sum of the fte counts at each grouped level.So I cant use the total as it'll give the grand total of all the line entries.But I am not finding any option for this kind of total.(Total of the subtotals)
    Pls give me a solution ASAP

    Hi,
    I am devoloping a report which pulls the expense lines for each project.I am displaying the fte count at each line.As it'll be same for a particular project,all the lines for that particular project will show the same FTE count.I am grouping the
    lines by Project No in Desktop edition.Now I want the total fte count which is the sum of the fte counts at each grouped level.So I cant use the total as it'll give the grand total of all the line entries.But I am not finding any option for this kind of total.(Total of the subtotals)
    Pls give me a solution ASAP

  • Problem with the total in the Query

    Hi people,
    In my report I have the colums "Shipping cost Number" and  "Delivery Number" where I can have 1:N.
    Obs.: This kind of report is based on a InfoSource that has the total by Shipping Number and not by Delivery number. So, for not triplicate the shipping values (for some cases) it was necessary create a new colum "shipping cost by delivery", besides "shipping cost", and calculate based on "% Delivery" (*)
    (*) % Delivery = Quantity Delivery line / Total of Quantity Delivery.
    Folow the situation:
    .....Shipping Cost Number"..."Delivery Number"...  Shipping Cost"..."Shipping Cost by Delivery"..."Quantity Delivery"..."% Delivery"
    .....1475441...........................84262109.................500,00................500,00....................................2,000.....................100,00
    Subt........................................................................500,00................500,00....................................2,000.....................100,00
    .....1475558...........................84262081................5.000,00..............1.846,09.................................35,120.....................36,92
    .....1475558...........................84262117................5.000,00..............2.102,61.................................40,000.....................42,05
    .....1475558...........................84262125................5.000,00..............1.051,30.................................20,000.....................21,03
    Subt.......................................................................5.000,00..............5.000,00.................................95,120....................100,00
    Considering :
    The "total of Shipping Cost" was calculated to represent the same value.
    The "total of Shippin cost by Delivery" was calculated to represent de SUM of the colum, instead of to calculate based on "% delivery"
    When I take of the colum "Delivery Number", many colums get the total wrong:
    % delivery..........wrong......correct
    Ship 1475441.....2,06.........100,00
    Ship 1475558....97,94........100,00
    In this case, the report is calculating incorrectly (Ex. for the first line: (2,000 / 97,120) instead of (2,000 / 2,000)
    shipping cost.....wrong..........correct
    Ship 1475441.....500,00.........500,00
    Ship 1475558....15.000,00.....5.000,00
    In this case, the report is disconsidering the configuration (taking the first value) that I put to calculate de total
    Shipping Cost by Delivery......wrong..........correct
    Ship 1475441.........................10,30............500,00
    Ship 1475558.........................14.961,10.....5.000,00
    In this case, it is the consequency of the calculation above.
    ***Summary
    ....Shipping Cost Number"..."Shipping Cost"..."Shipping Cost by Delivery"..."Quantity Delivery"..."% Delivery"
    ....1475441...........................500,00................10,30......................................2,000.......................2,06
    ....1475558..........................15.000,00............14.691,10...............................95,120.....................97,94
    Please, I need very much to find out some solution for this problem of "total" when we take of some colum.
    Thank you,
    Rosana

    Hi Rosana,
    I think exception aggregation will be usefull in you case.
    Check the below links which gives info about exception aggregation
    http://wiki.sdn.sap.com/wiki/display/BI/Exceptionaggregationin+queries
    http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/605f1751-a701-2a10-b791-9da5ba4f2a64
    http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/00cd3483-1573-2910-7aba-b81a36ce0ec2
    Hope this helps,
    Sri....

  • Problem in the total of the Query

    Hi people.
    I have a Query where there is 3 itens for exemple with the same value.
    Document A=3Km   Document B=3Km   Document C=3Km   and the total i configurated to show the same value=3Km
    But when I take of the driw down where will show only one line, the query show the total 9Km instead of 3Km.
    The query lost the parameter I have put to show the same value.
    Do you know how I can do to show the same value=3Km when I have the query wothout driwdoun?
    Thanks.

    Hello,
    Just try if this works..In your Amount formula, click on Aggregation tab, select Exception aggregation as Maximum or Minum  and select Reference characteristic as the lowest level in your hierarchy.
    Thnaks.
    With regards,
    Anand Kumar

  • Any method to mask the "Total" in the form of Delivery?

    I have tried to create a picture box to mask the "Total" value (UI),when I resize the form , the picture box become transparent!!! Is it prossible to mask a field in the form using UI?

    Just access the total textfield and make it visible = false;
    oForm.Items.Item("29").Visible = false; //The field
    oForm.Items.Item("30").Visible = false; //The label
    If that doesn't work try setting the left property to something that will never come into view no matter how large you make the window... Something like this
    oForm.Items.Item("29").Left = 5000; //The field
    oForm.Items.Item("30").Visible = 5000; //The label

  • How to get page totals at the end of the report in BI Publisher

    I am using BI Publisher 10.3 and using Ms-Word template builder to design the report
    and I want to implement totals for some columns (like page totals) ... can anyone let me know how to go about this
    Thanks

    Take a look this blog: http://blogs.oracle.com/xmlpublisher/entry/anatomy_of_a_template_iii_page
    You can download the template for that page.
    Also take a look at the Samples folder within your BI publisher desktop folder and you can find a folder "Page Total" that has the RTF template, xml and output..
    Assign points if helpful.
    Thanks,
    Bipuser
    Edited by: BIPuser on Aug 18, 2011 8:24 AM

  • Report Script - How to get the total on the any number of rows selected

    Hi,<BR>I am using Essase and report script for the reporting purpose. In this i would like to know how to get the sum of all the rows selected. I know we can use the calculate row, but it has to be done with print row to display the newly created row. But i am using alphablox where this print row is not working. Is there any other alternative is there to get the sum of any number of rows, and displaying them??<BR>Please help me.<BR><BR>Regards<BR>R.Prasanna

    Pls check the structure and index.
    EMP_ID NUMBER(9) NOT NULL,
    EMP_CD           NUMBER(3),
    EMP_NO VARCHAR2(250 BYTE) NOT NULL,
    FROM_EFF_DT DATE NOT NULL,
    TO_EFF_DT DATE,
    CREATE INDEX IDX_EMP_NO ON EMP
    (EMP_NO)
    NOLOGGING
    TABLESPACE INDEXES
    PCTFREE 20
    INITRANS 10
    MAXTRANS 255
    STORAGE (
    INITIAL 56K
    NEXT 1784K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    NOPARALLEL;

Maybe you are looking for

  • Sharepoint Report Subscriptions not showing on sharepoint website, but are in the database

    Hi All, We have had an issue which sharepoint where our subscriptions for reports "disappear" from the website. This makes is a little hard to edit them if we need to adjust the subscription. The funny thing is the subscription is still working as it

  • Installed new hard drive and ram but freezes on apple logo

    i have a mid 2010 macbook pro and last night i opened it up and installed a 750GB hard drive and 8gb of ram. now my computer doesn't want to boot up, even with the install DVD (original one) i have done the PRAM thing and even went back to my old har

  • How do I choose a default startup drive?

    I have two startup drives on my Hard Drive. One is Snow Leopard and the other is Leopard. I need Leopard for some printing issues with Photoshop and Epson. How do I choose a default startup drive? Most of the time I want the Snow Leopard drive at sta

  • BPEL PM Standalone

    Which application server is bundled with BPEL PM standalone download. If it is iAS will it be Weblogic anytime soon. thanks

  • Transform tool help

    Hello, I just upgraded to CC about a week ago. Since the upgrade, I am not able to transform images or shapes the way I used to. I like being able to size objects by using the up and down arrows to the left of the width and heigth boxes, located in t