Column totals

In the example below, I'm trying to perform a column total on my New Stmt Count column. I've tried several different things. Can anyone help with this? I'm using SQL Developer 1.1 Patch 1.
SELECT ALL ADMIN, LNAME,
COUNT(STATEMENT_DATE) "New Stmt Count"
FROM
Results return like this, but I also need the total number 5 to return .....
12345 Apple 2
54321 Orange 3

That doesn't seem like the result that the original poster wants:
SQL> create table mytable
  2  as
  3  select 12345 admin, 'Apple' lname, sysdate statement_date from dual union all
  4  select 12345, 'Apple', sysdate from dual union all
  5  select 54321, 'Orange', sysdate from dual union all
  6  select 54321, 'Orange', sysdate from dual union all
  7  select 54321, 'Orange', sysdate from dual
  8  /
Tabel is aangemaakt.
SQL> select all admin
  2       , lname
  3       , count(statement_date) "New Stmt Count"
  4    from mytable
  5   group by rollup(admin,lname)
  6  /
                                 ADMIN LNAME                          New Stmt Count
                                 12345 Apple                                       2
                                 12345                                             2
                                 54321 Orange                                      3
                                 54321                                             3
                                                                                   5
5 rijen zijn geselecteerd.But with the use of grouping sets:
SQL> select all admin
  2       , lname
  3       , count(statement_date) "New Stmt Count"
  4    from mytable
  5   group by grouping sets ((admin,lname),())
  6  /
                                 ADMIN LNAME                          New Stmt Count
                                 12345 Apple                                       2
                                 54321 Orange                                      3
                                                                                   5
3 rijen zijn geselecteerd.Regards,
Rob.

Similar Messages

  • How to add text labels to computed column totals in a banded report?

    I'm sure I'm missing something obvious here. I have a simple report with a table that consists of 3 DB field columns and 3 computed columns. I have the 'show column total' property enabled and it inserts the totals at the bottom of the computed columns. What I haven't been able to do is insert a label to the left of the computed totals. I tried inserting a blank field and adding my label, but the location is not dynamic - if one grouped item has 3 rows and the next has 4 the inserted field does not flow to the bottom of the table for each group, it displays in the same position for each group.
    What property/option am I not seeing?
    Thanks!
    Edited by: user11293154 on Jun 22, 2009 1:03 PM

    Thanks for the reply. I'm using Interactive Studio version 9.3, but can't find the 'Set Spring' feature. The help file doesn't have a reference to it. There is a Spring(method) with this example;
    ActiveDocument.Sections["Report"].Body.Tables["Table"].Spring("Chart")ActiveDocument.Sections["Report"].Body.Tables["Table"].Spring("Pivot")

  • How to divide 2 columns totals in ALv grid

    Hi All,
    i developed alv report & displayed totals. now i need to divide those totals and display as another column total.
    anyone please suggest.
    col1    col2    col3
    tot1     tot2     tot3
    tot3 = tot2 / tot1.
    thanks,

    Hi,
    For this, in HTML_TOP_OF_PAGE or  TOP_OF_PAGE first you need to get global reference variable for GRID
    for getting reference call FM GET_GLOBALS_FROM_SLVC_FULLSCR.
    By using this reference  call method GET_SUBTOTALS it will get the all total into Internal Table .
    Using Field Symbols u can calculate. Still u have any problem i will help u further .
    Regards,
    Ravindra.

  • Issue with column Total in a table

    Hi All,
    I am facing a strange issue with the column total value in an advanced table. I have enabled Total for a number column in the table, and added a total item in the footer section.
    This is working fine for the small numbers (10 digits) . But for the bigger numbers , once the sum is calculated the sum data is getting populated in one of the fields. This is for numbers with 30 digits.
    Pls suggest a solution for this.
    Thanks!
    Srikanth

    Unbelievable :)
    Numbers with more than 30 digits ?!!!?
    What kind of application is that? ;)
    --Prasanna                                                                                                                                                                                                                       

  • Navigation on row and column total in pivot report

    Hi All,
    I have created a pivot report with 2 dimension columns and one measure and defined row and column total. Now, users wants to have a navigation report on the row/column total so that once he clicks on total value, he can see the detail report. While doing this, he also wants to pass on the 2 dimension column values to detail report.
    Is there any workaround for this?
    Thanks in advance.

    use a formula column/row. use RANK function in that. (e.g. Rank([A], asc) will sort the rows based on column A values in ascending order)
    you can use this rank in your heading.
    But frankly this is not so easy. You have to do it in a very intelligent way, so that rank gives you column number/row number any how.
    Have a try and let see if you find a appropriate solution.
    Regards,
    Rahul

  • How can I get column totals with group breaks

    We manually generate a report of file groups and their associated data files each day for each of our databases.
    For each database we take data from dbcc showfilestats and assemble it into an Excel spreadsheet (see below).
    I would like to use a SQL job to generate the reports (results do not need to be in Excel format). I can insert the data from the DBCC into a table; but, I'm stuck on how to write a select statement that will break on file group and provide column totals.
    I've been looking at group by; but, I don't see how to make it work.
    Suggestions?
    FileGroup
    FileID
    Volume
    Allocated(MB)
    Used space(MB) 
    Free space(MB)
    Used %
    1
    1
    Data1
    100
    50
    50
    50%
    1
    15
    Data2
    200
    175
    125
    87.50%
    1
    21
    Data3
    300
    200
    100
    6.60%
                600
    425
    275
    70.80%
    FileGroup
    FileID
    Volume
    Allocated(MB)
    Used space(MB) 
    Free space(MB)
    Used %
    2
    1
    index1
    100
    50
    50
    50%
    2
    15
    index2
    200
    175
    125
    87.50%
    2
    21
    index3
    300
    200
    100
    6.60%
    600
    425
    275
    70.80%

    Take a look at the following blog on subtotal, total & grand total:
    http://www.sqlusa.com/bestpractices2005/subtotaltotalgrandtotal/
    It appears that you need only 1 level of totals.
    BOL:
    Summarizing Data Using ROLLUP
    Kalman Toth Database & OLAP Architect
    SELECT Video Tutorials 4 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Groovy expression for column total not working

    I want to show the column total. I have created a view accessor on the view object and a new attribute of Transient type and set its expression to AccessorName.sum("columnName").
    But its values is never calculated when I test the view object.
    Any help on this is appreciated.
    PS: The total is calculated correctly when the view object does not have any bind variable. Once I add a bind variable the column total is not being calculated. I have verified this. Any help on how to handle this issue ?
    Using JDev 11.1.2.3

    If you could have elaborated a bit more it would have been useful , but apparently i can think of few thing which you could double check.
    1. The transient attribute type is Number.
    2.If the column exist on the same view object then you should write sum("ColumnName") else you have to create a view accessor on the VO and set its expression to AccessorName.sum("columnName").
    Hope it helps !!
    Else you could elaborate a more for us to help
    Thanks
    Soumya.

  • Possible to hide but not supress Crosstab column totals?

    The reason I ask is because I really don't want to show the whole crosstab column totals section.
    Only reason I need the column totals of a crosstab is because I am taking some field values off of it by defining variables using a supression formula.
    I then take the variable and make a calculation on the crosstab itself... just not on the column totals.
    So simply put,
    Any way to 'hide' column totals in Crosstabs?  Supressing it in Cross-tab Expert would render my declared variables to zero.

    Hi Brian.
    Unfortunately, the column that would-be hidden using your method would also be something I need to show in the actual Crosstab summary calculations.
    Ultimate goal is to show all the summary calculations but just hide the "Column Totals" which also has a supression formula declared in order to use that variable in a display string within a Crosstab summary field.
    A bit complicated without showing the Crosstab but that's the best way I can explain it I guess.

  • Hiding a column if the column total is 0(zero)

    Hi,
    I am trying to hide the entire column if the column total is 0.
    Template sample:
    Num
    IF Amt1 end if
    Amt2
    IF Amt3 end if
    F NUM
    IF $0.00 end if
    $0.00
    IF $0.00 end if E
    Totals
    IF $0.00 end if
    $0.00
    IF $0.00 end if
    Sample Data:
    Num
    Amt1
    Amt2
    Amt3
    001
    108.25
    28.00
    0.00
    002
    0
    445.00
    0.00
    003
    100.12
    472.00
    0.00
    004
    145.00
    872.00
    0.00
    005
    16.30
    25.32
    0.00
    I am using the below expressions which is not working.
    <?if@column:sum(amt1)!=0?> <?amt1?> <?end if?>
    <?if@column:sum(amt3)!=0?> <?amt3?> <?end if?>
    I would like to hide the entire Amt3 cloumn and leave the '0' at amt1 as it is. Any help would be much appreciated.

    you can try like
    before the table do the sum(amt3) column using variable and store that value in a variable then use that variable which u stored the sum(amt3) column value .
    F variable cal to get the sum of amt3 column E
    Num
    IF Amt1 end if
    Amt2
    IF Amt3 end if
    F NUM
    IF $0.00 end if
    $0.00
    IF $0.00 end if E
    Totals
    IF $0.00 end if
    $0.00
    IF $0.00 end if
    then use <?if@column:variable!=0?> <?amt3?> <?end if?>
    if it is not working for you send me template and xml to my email i can try it from my side and send u updated template.
    my email : [email protected]

  • Display column total on the header using Formatted Search

    Hello,
    I'm trying to create a FS on a Sales Order header (UDF) that will summarize a
    column from the row level.
    For example, I'd like to display the sum of the quantity in the header.
    I've tried the following syntax: Select sum($[$-38.11.NUMBER]) but I get
    only the first line as query result and not sum of all lines.
    Is it possible to get the column total using FS? If so, what should be
    the syntax?
    Thank you in advance,
    Maya

    Columns totals are not possible to get through formatted search as the data of the first row is only referenced by the system automatically.
    If you are needing the Sum of LineTotal for a Approval procedure, then you could use the Total Before Disc col which is actually the sum (line total)
    Access by
    SELECT $[$22.0.Number]

  • Report with columns - totals in column at far right

    Hi All,
    A user would like to see a report in this type of format:
        Total Shift 1       Total Shift 2     Total Rpt Info
    But not as simple as this.  Meaning the data in the last column is not a total of shift 1 and shift 2, but different total information. Anyway, I have to be able to get back to a prior line number to do this.  Is there a way to do this other than write statements and creating strange internal tables that would hold all the literals and values that need to be output? Like this:
    itab
    record 1 = line 1
    field 1 - shift 1 labels
    field 2 - shift 1 data
    field 3 - shift 2 labels
    field 4 - shift 2 data
    field 5 - total labels
    field 6 - total data
    Is there a better way to do this? This would be extremely tedious.

    Hi Janet,
    from your posting it is not obvious what your list is to look like.
    anyway I'd recommend to construct an internal table with a structured row.
    Then fill the records with the data. The last step should be the calculation of results for the last column. You could do that depending on a field in  this row.
    For instance, have a 'formula' column where you put a subroutines name. The subroutine calculates the last columns value taking into account whatever rows and columns necessary.
    i.e.
    loop at valuetab.
    perform (valuetab-formula).
    endloop.
    in the 'formula' subroutine you may read other table lines and columns.
    Output should be done using ALV display. If you are a starter, use Function REUSE_ALV_LIST_DISPLAY or REUSE_ALV_GRID_DISPLAY.
    Good luck,
    Clemens

  • Column Totals of a table region in OAF Page

    Hi,
        I developed a custom OAF page with a table region (NOT an Advanced table region). It has several columns and one of them is a flag column of checkbox type and also there is amount column.
    My requirement is to display totals on the amount column based on the flag value. So if there are 4 records out of which 3 of them have flag = "Y"
    then at footer level, one line should display Total Amount when flag = "Y"   as sum(amount_column) with flag = "Y"
    and another line should display : Total Amount when flag = "N"  as sum(amount_column) with flag = "N".
    Can anybody help me how I can accomplish this?
    Note: I tried to use "Total" property to "True" but it is displaying data irrespective of my flag value. Some how, I should be able to filter the total based on the flag column. Also I need to display as one total per each flag value...
    Please note that I am using Table region NOT Advanced table region.....I appreciate of some one can give me detailed steps to accomplish this. Thanks
    Sample output....
    Flag            Amount
    Y                       100
    N                         50
    Y                         15
    Y                         20
    Total with "Y" = 135
    Total with "N" = 50

    hi Smitha,
        We cannot avoid that. but an alternate is that use another table above this table and which has the number of rows as zero. hide the table header for the below table. you need to adjust the header of above table so that it fits for the below table.
    This works fine if the table doesn't have sorter facility.
    Regards,
    Gopi

  • Calcualting the formula column total.

    Hi All,
    I am very new to bi publisher..I have a requirement where i need to find the total of the formula column..how can i achieve this?
    and also i need to find the total of balance group by month..here is the sample output what i need.Please help its urgent
    Date Amount CalcAmount Balance
    1-jun-2010 100 150 200
    3-jun-2010 50 50 300
    5-aug-2010 100 50 200
    6-aug-2010 300 60 400
    310
    Jun:500 Aug:600
    How to achive this....where calcamount field is not coming from any input file..this i did manually in rtf template..
    Please help is urgent
    Thanks in Advance
    Bharat

    Hi Ananth,
    i tried with this..Now the calculated column value its showing as NaN.
    my requiremnt is thr is one form value called OPC(reguler text) and the logic inside is <?xdofx:if APPLIED>AMT then to_number(APPLIED- AMT) else 0 ?>
    and as per yous solution i have created one form value below to that i wrote the logic like this <?xdoxslt:set_variable($_XDOCTX,'var', xdoxslt:get_variable($_XDOCTX,'var‘)+ OPC)?>
    and in the total column i have created one more form value and wrote this code <?xdoxslt:get_variable($_XDOCTX, 'var')?>
    so now the total is coming as NaN.
    Please help.
    Thanks
    Bharat

  • How to sort column totals in pivot view

    Hello guys
    I have a report in pivot view where I have put call type on the column section. So the report looks like below with SUM applied at the column section:
                                       Call Type1         Call Type2       Call Type3               TOTAL
    ID                                        SALES TOTAL
    A                                  100                  200                300                       500
    B                                  200                  200                400                       800
    C
    D
    EMy question, how do I sort the data in 'TOTAL' field? The challenge it seems is that since 'TOTAL' isn't a table column, but just a display of pivot Sum, it can't be sorted H-L or L-H..
    But I'd like to have some advice from you guys before I make my conclusion
    Thanks
    Edited by: user7276913 on Jan 11, 2010 10:05 AM

    You can't have the sorting on the total in Pivot table.
    On a workaround,
    you can create a column in the criteria which calculate the sum
    SUM(sales_total by ID)Assign sorting order on this column
    You can exclude this column in the pivot table
    Regards,
    Raghu

  • Column Total in RTF

    Hello,
    Here is a sample of my report.
    Project Name | Task Name | Current | Bill | Apply
    P1 | T | 300 | 0 | 300 (sum of T1 and T2)
    | T1 | 200 | 0 | 200
    | T2 | 100 | 0 | 100
    P2 | T | 400 | 0 | 400
    Grand Total
    P | T | 700 | 0 | 700 (Total P1 + Total P2)
    How can I get 700 as the grand total in the last row, last column?
    Please help!!

    Hello,
    Here is a sample of my report.
    Project Name | Task Name | Current | Bill | Apply
    P1 | T | 300 | 0 | 300 (sum of T1 and T2)
    | T1 | 200 | 0 | 200
    | T2 | 100 | 0 | 100
    P2 | T | 400 | 0 | 400
    Grand Total
    P | T | 700 | 0 | 700 (Total P1 + Total P2)
    How can I get 700 as the grand total in the last row, last column?
    Please help!!

Maybe you are looking for

  • Is it possible to use a portlet backing file on the dvt_enabler portlet?

    We currently have a 9.2 portal with a simple login form portlet that uses a backing file to do much security checking, authentication against ActiveDir, etc. Our requirement is to convert to WLP 10.3 using the DVT enabler portlet or something like it

  • Audio and hdmi

    My monitor(projector) has no speakers and I have no receiver that supports the optical audio output.  Is there a way to preserve the hd video going to my monitor while separating the audio so I can use a sound system to amplify the sound? I'm nervous

  • Distiller error log, cant understand what it means

    Im trying to create a postscript file from a booklet created in Pagemaker (yeah i know, but thats what they made it in!).  When I try to use distiller to create the PDF from it, im constantly getting this error... %%[ Error: typecheck; OffendingComma

  • CDF Error

    Hello, I am having an issue and hope you can help me solving it. There is a JAR file from DRAGOS I installed and registered and is working fine and I could see and use the java functions .. so I think I am comfortable with the registration process it

  • Matching config file Crystal Reports 8

    Post Author: BBUSA CA Forum: General I am a novice user with Crystal Reports 8. I have been using it to modify existing reports. Now I would like to write new reports. When I try to link the new report to my application software it does not show up a