Totals in a query

I have the following query. I want to add totals for open qty  and open line totals in this query. How can I do it? The selection criterea will select only one customer.
SELECT  T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T1.[ItemCode],
T1.[Dscription], T1.[OpenQty] as [Backorder Qty],
T1.[LineTotal] as [Row Total]
FROM Pitkar.dbo.ORDR T0 INNER JOIN Pitkar.dbo.RDR1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN Pitkar.dbo.OITM T2 ON T1.ItemCode = T2.ItemCode WHERE
T1.[LineStatus] ='O' and T0.[CardCode] between [%0] and [%1]

Hi,
This might help also.
SELECT 
T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription],
sum(T1.[OpenQty]) as [Backorder Qty], sum(T1.[LineTotal]) as [Row Total]
FROM ORDR T0
INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T1.[LineStatus] ='O' and T0.[CardCode] between '[%0]' and '[%1]'
GROUP BY T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription]
ORDER BY T0.[CardCode]
Regards,

Similar Messages

  • How to get total numbers and total price in query reports

    Hi,
    how to get total numbers and total price in query reports.for example:
    particular item is issued 3 times a week...I need total quantity of item issued
    my query...
    SELECT T0.[DocNum], T1.[ItemCode], T1.[Quantity], T1.[Price] FROM OIGE T0  INNER JOIN IGE1 T1 ON T0.DocEntry = T1.DocEntry WHERE T1.[ItemCode]  Like '%%[%1]%%'  and  T1.[U_WOType]='[%0]'

    Hi,
    Try this:
    SELECT T1.[ItemCode], SUM (T1.[Quantity]) as [Total Quantity], SUM (T1.[Quantity] * T1.[Price]) as [Total Price] FROM OIGE T0  INNER JOIN IGE1 T1 ON T0.DocEntry = T1.DocEntry WHERE T1.[ItemCode]  Like '%%[%1]%%'  and  T1.[U_WOType]='[%0]'
    Group By T1.[ItemCode]
    Beni.

  • Difference between 2 sub-totals in SAP query

    Hello Experts,
    Is there any possibility to find out the difference between 2 sub-totals and display it at the bottom of the ALV output( like total) in SAP Query using SQ01.
    For example: see below example(Request you to paste the below in an excel sheet for more readability).
    PRZ     25.05.2011     A 007 008 01 15     10     EA           0,00     INR          0,00     INR          2,00     INR               0,00     INR
    PRZ     27.05.2011     A 007 008 01 00     1     PC          10,00     INR          0,00     INR          0,20     INR               0,10     INR
    PRZ     27.05.2011     A 007 008 01 00     1     PC          10,00     INR          0,00     INR          0,20     INR               0,10     INR
    Sub-total               10     EA     20,00     INR          0,00     INR     2,40     INR     20     INR
                   2     PC                                        
    DRP     26.05.2011     WDB2020261X744924     1     PC          60,00     INR         50,00     INR         30,00     INR               0,00     INR
    DRP     31.05.2011     WDB2020261X744924     1     PC          60,00     INR         50,00     INR         30,00     INR               0,00     INR
    Sub-total               2     PC     120,00     INR     100,00     INR     60,00     INR               0,00     INR
    Grand totals               10     EA     140,00     INR     100,00     INR     62,40     INR     20     INR
                   4     PC                                        
    In the same way as Grand total, Is there any possibility to find out the difference between the 2 sub-totals and display at the bottom after the Grand Totals row.
    Please let me know if there is any possibility for the same.

    Just to update on my question.
    In the sub-totals line you can see that there is 20,00 INR value which is summation of the above fields present in individual line numbers above. And the same way for the rest of the fields as well.
    After calculating the sub-totals in this manned, I need to find out the difference between the subtotals and display it at the bottom of the output.
    Please let me know if this is possible.

  • Finding a total in a query

    Hi People.
    If it's one thing that gets me every time is pulling a total of inputs from a table for a common entry. The query below is pulling a list of logged hours for a production order (or an addon to SAP B1 called a process order).
    I want to have a single line with the production order number, with the total of planned hours per labour task with a total of the actual hours recorded for that production order. I've stripped this query back to the basics and placed it as best I know but I'm still getting multiple lines per production order.
    Any help would be great.
    SELECT distinct t0.PrOrder, sum(t1.Quantity) [PlannedQty2], sum(t2.[total quantity]) [ActualQty2]
           FROM IIS_EPC_PRO_ORDERH t0
           left JOIN (select distinct t1.prorder,  sum (t1.quantity) [Quantity] from IIS_EPC_PRO_ORDERL t1 group by t1.prorder, t1.quantity) as t1 ON t0.PrOrder = t1.PrOrder
        left JOIN (select distinct t2.prorder,  sum(t2.quantity) [total quantity] from  IIS_EPC_PRO_ORDERT t2 group by  t2.prorder, t2.quantity) as t2 ON t0.PrOrder=t2.PrOrder
          WHERE  t0.sonum > '0'
           GROUP BY t0.PrOrder, t1.Quantity, t2.[total quantity]

    Hi Try this,
    I just removed quantity field in group by
    SELECT distinct t0.PrOrder, sum(t1.Quantity) [PlannedQty2], sum(t2.[total quantity]) [ActualQty2]
           FROM IIS_EPC_PRO_ORDERH t0
           left JOIN (select distinct t1.prorder,  sum (t1.quantity) [Quantity] from IIS_EPC_PRO_ORDERL t1 group by t1.prorder, t1.quantity) as t1 ON t0.PrOrder = t1.PrOrder
        left JOIN (select distinct t2.prorder,  sum(t2.quantity) [total quantity] from  IIS_EPC_PRO_ORDERT t2 group by  t2.prorder, t2.quantity) as t2 ON t0.PrOrder=t2.PrOrder
          WHERE  t0.sonum > '0'
           GROUP BY t0.PrOrder

  • Help to generate totals in Hierarchical Query

    Hi Everyone,
    I've a small problem which I hope you might be able to help me with:
    I've the following 3 tables populated with sample data:
    --- Element_relation defines the hierarchical relationships ---
    create table element_relation (parent varchar2(10),child varchar2(10)) tablespace users;
    --- 'A' is the parent element with parent = 'NA' ---
    insert into element_relation values('NA','A');
    insert into element_relation values('A','B');
    insert into element_relation values('B','C');
    insert into element_relation values('C','D');
    --- 'B' is the parent element with parent = 'NA' ---
    insert into element_relation values('NA','A1');
    insert into element_relation values('A1','B1');
    insert into element_relation values('B1','C1');
    insert into element_relation values('C1','D1');
    --- invoice_detail has the invoice_no, element_id referencing the child column in element_relation column and its amount ---
    create table invoice_detail (invoice_no number,element_id varchar2(10),amount number) tablespace users;
    insert into invoice_detail values(1,'D',10);
    insert into invoice_detail values(2,'D1',20);
    insert into invoice_detail values(3,'B',20);
    --- invoice_header defines the invoice header and link to invoice_detail table ---
    create table invoice_header (invoice_no number,Invoice_description varchar2(20)) tablespace users;
    insert into invoice_header values(1,'AAA');
    insert into invoice_header values(2,'BBB');
    insert into invoice_header values(3,'CCC');
    My problem is I need to a build a query that will populate the following output:
    Invoice_no Element_id Total
    1 A 10
    1 B 10
    1 C 10
    1 D 10
    as well as the relevant output for Invoice_no 2 and 3. I managed to build the following SQL but it only works for one invoice_no at a time instead of traversing through all the invoice number in the invoice_header table. Here is the SQL statement that I've built:
    select a.invoice_no, b.child, sum(a.amount)
    from invoice_detail a,
    (select child from
    element_relation connect by child = prior parent start with child in
    (select element_id from invoice_detail where invoice_no = 1)) b
    where a.invoice_no = 1 and
    a.element_id in
    (select child from element_relation
    connect by prior child = parent
    start with child in b.child)
    group by a.invoice_no,b.child
    Any comment is much appreciated. Thank you for everyone's time spent on this issue.
    Regards,
    John

    Hello John, I put the (1,2,3) list in the query to show it works with multiple invoices.
    You should comment out the conditions:
    select a.invoice_no, b.child, sum(a.amount) from invoice_detail a,
    select
    child,
    decode (instr(scbp,'.'),0,scbp,
           substr(scbp, 1, instr(scbp,'.') -1)
           ) starting_child
    from (
    select ltrim(sys_connect_by_path(child,'.'),'.') scbp,
    child from
    element_relation
    start with child in (select element_id from invoice_detail /* where invoice_no in (1,2,3) */)
    connect by child = prior parent
    ) b
    where a.element_id = b.starting_child
    /* and a.invoice_no in (1,2,3) */
    group by a.invoice_no,b.child
    order by 1,2to show it works for all invoices
    regards, Tony

  • 30,60,90 Days Totals in sql query

    Hi All,
    Here I  have written a query to find the total for 30Days to calculate costs....
    These 30Days Amount will be populated into another table based on joins.
    I know we can do by case in the final update but lot of logic is going into temptables1 and 2, so please help...
    select distinct ip.membernbr,ip.patcom,ip.admitdate,ip.dischargerdate,dateadd(day,1,ip.dishargedate) as afterdishcargedatestart,
    dateadd(day,30,ip.dishargedate) as afterdishcargedateend, cd.specificdateofservice as ipdos, cd.specificdateofservicethry
    as ipdosthru
    into #inpatientdoshospice30
    from tbl_inpatient ip
    join claimsdetail cd on cd.membernbr=ip.membernbr
    join claims c on c.claimsseqnbr=cd.claimnsseqnbr
    where c.formnbr='inp'
    and cd.specificdateofservice between dateadd(day,1,ip.dishargedate)
     and dateadd(day,30,ip.dishargedate) 
    and cd.specificdateofservicethru
    between dateadd(day,1,ip.dishargedate)  and dateadd(day,30,ip.dishargedate) 
    --find part c hospice claims lines that that are already included in the inpatientcost(c.formnbr='INP')
    cost;
    --doing this in a separate step in case there are multiple inpatient claims which dos dates that overlap
    (e.g; 1/15 to 1/20 and ---1/18 to 1/20) causing us to overstate dollars
    select distinct ip.patcom,cd.claimssequencenbr
    into #Hospiceinpatientclaimnslines30
    from
    #inpatientdoshospice30 ip 
    join claimsdetail cd on cd.membernbr=ip.membernbr
    and cd.specificdateofservice between dateadd(day,1,ip.dishargedate)  and dateadd(day,30,ip.dishargedate) 
    and cd.specificdateofservicethru between dateadd(day,1,ip.dishargedate)  and dateadd(day,30,ip.dishargedate) 
    join claims c on c.claimsseqnbr=cd.claimnsseqnbr
    where c.formnbr='Hospice'
    --sum all hospice claims excluding those already included in the inpatient
    update pp
    set homehospicecost30day=isnull(sub.hospicecost,0)
    from inpatient pp
    left join(
    select ip.patcom,sum(isnull(cd.netamt,0.00)) as hospicecost
    from tbl_inpatient ip
    join claimsdetail cd on cd.membernbr=ip.membernbr
    and cd.specificdateofservice between dateadd(day,1,ip.dishargedate)  and dateadd(day,30,ip.dishargedate) 
    and cd.specificdateofservicethru between dateadd(day,1,ip.dishargedate)  and dateadd(day,30,ip.dishargedate) 
    join claims c on c.claimsseqnbr=cd.claimnsseqnbr
    where (c.formnbr='Hospice' or (c.formnbr='PartB' and cd.placeofservice in ('34')))
    and cd.claimsseqnbr not in (select cklaimseqnbr from #hospiceinpatientclaimlines30 sub where sub.patcom=ip.patcom)
    group by ip.patcom
    )sub
    on pp.patcom=sub.patcom
    I really appreciate your help.
    Thanks,
    Kalyan.

    The UPDATE can be written this way:
    update pp
    set    homehospicecost30day = isnull(sub.hospicecost,0)
    from   inpatient pp
    left   join(select ip.patcom,
                       sum(CASE WHEN cd.specificdateofservice between 
                                     dateadd(day,1,ip.dishargedate)  AND
                                     dateadd(day,30,ip.dishargedate) 
                                 AND cd.specificdateofservicethru between
                                     dateadd(day,1,ip.dishargedate)  and 
                                     dateadd(day,30,ip.dishargedate) 
                                THEN isnull(cd.netamt,0.00)
                                ELSE 0
                            END) as hospicecost30
                from   tbl_inpatient ip
                join   claimsdetail cd on cd.membernbr=ip.membernbr
                join   claims c on c.claimsseqnbr=cd.claimnsseqnbr
                 where  (c.formnbr='Hospice' or
                        (c.formnbr='PartB' and cd.placeofservice in ('34')))
                   and cd.claimsseqnbr not in (select cklaimseqnbr from
                                               #hospiceinpatientclaimlines30 sub
                                               where sub.patcom=ip.patcom)
                 group by ip.patcom)sub
    on pp.patcom=sub.patcom
    The pattern shows how you can add further days.
    I was not able to figure out the meaning of the temp tables, and since you said that you typed it from memory without access to the code, I don't trust that you got everything right. Give it a second look on Monday.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to create a sub total and grand total using my query.

    How can I create a sub total for each section and grand total for using my query like this.  your help is appreciated. I am working with 9g
    WITH  BidItemsInformation  AS
    ( SELECT DISTINCT q.iplineno "Line Number", q.section "Section Number",
             i.item "Item Number",
             initcap(i.idescr) "Description" ,
             i.iunits "Unit",
             q.qty "Quantity" ,q.price  "Engineers Unit Price",
           (q.price * q.qty) "Engineers Estimate"
         FROM letprop l,
            proposal p,
            propitem q,
            bidlet b,
            bidtabs c,
            itemlist i,
            vendor v,
            bidders d 
         WHERE(l.letting = b.letting
                And b.letting = c.letting
                And p.cspecyr = i.ispecyr)
                AND q.prpitem = i.item
                AND p.contid = l.lcontid
                AND q.contid = p.contid
                AND c.vendor = l.avendor
                AND l.CALL = c.CALL
                AND q.lineflag = c.lineflag
                AND q.iplineno = c.iplineno
                AND l.letting = d.letting 
                AND c.letting = l.letting
                AND c.CALL = d.CALL
                AND v.vendor = d.vendor
                --  AND AND l.letstat = 'A'
                AND c.lineflag = 'L'
                AND  l.letting ='&letting'
                AND l.CALL = '&call'
    ), BiddersInformation  AS
    -- This is where you make your changes for vendor name and vendor number Do not touch the above code
    -- It is always the same for any call number and letting date
    ( SELECT IPLINENO "BLine Number",
            MAX(CASE WHEN VENDOR='K020'  THEN bidprice ELSE NULL END) "K020:: Unit Price",
            MAX(CASE WHEN VENDOR='K020'  THEN bidprice ELSE NULL END) K,
            MAX(CASE WHEN VENDOR='H438'  THEN bidprice ELSE NULL END) "H438:: Unit Price",
            MAX(CASE WHEN VENDOR='H438'  THEN bidprice ELSE NULL END) H,
            MAX(CASE WHEN VENDOR='U010'  THEN bidprice ELSE NULL END) "U010:: Unit Price",
            MAX(CASE WHEN VENDOR='U010'  THEN bidprice ELSE NULL END) U,
            MAX(CASE WHEN VENDOR='G110'  THEN bidprice ELSE NULL END) "G110:: Unit Price",
            MAX(CASE WHEN VENDOR='G110'  THEN bidprice ELSE NULL END) G,
            MAX(CASE WHEN VENDOR='H530'  THEN bidprice ELSE NULL END) "H530:: Unit Price",
            MAX(CASE WHEN VENDOR='H530'  THEN bidprice ELSE NULL END) H1
        FROM  BIDTABS
        WHERE LETTING='&letting'
              AND CALL='&call'
              AND BIDPRICE <> 0
        GROUP BY IPLINENO
    SELECT BidItemsInformation."Line Number",
           BidItemsInformation."Section Number",
           BidItemsInformation."Item Number",
           BidItemsInformation."Description",
           BidItemsInformation."Unit",
           BidItemsInformation."Quantity",
           BidItemsInformation."Engineers Unit Price",
           BidItemsInformation."Engineers Estimate",
           BiddersInformation."K020:: Unit Price",
            (BidItemsInformation."Quantity" * K) "KGM CONTRACTORS INC",
           BiddersInformation."H438:: Unit Price",       
            (BidItemsInformation."Quantity" * H) "HOFFMAN CONSTRUCTION COMPAN",
           BiddersInformation."U010:: Unit Price",       
            (BidItemsInformation."Quantity" * U) "ULLAND BROTHERS INC",
           BiddersInformation."G110:: Unit Price",      
            (BidItemsInformation."Quantity" * G) "GLADEN CONSTRUCTION INC",
           BiddersInformation."H530:: Unit Price",      
            (BidItemsInformation."Quantity" * H1) "HOOVER CONSTRUCTION CO"
    FROM   BidItemsInformation,BiddersInformation
    WHERE  BidItemsInformation."Line Number" = BiddersInformation."BLine Number";
    Line Number     Section Number     Item Number     Description     Unit     Quantity     Engineers Unit Price     Engineers Estimate     K020:: Unit Price     
    0010     0001     2011601/00003     Construction Surveying     LS       1     143,000     143,000     75,000     75,000     67,080     67,080
    0013     0001     2013601/00010     Survey Equipment     LS       1     25,000     25,000     25,000     25,000     30,000     30,000
    0020     0001     2015601/00030     Blast Monitor/Survey     LS       1     50,000     50,000     30,000     30,000     35,000     35,000
    0030     0001     2021501/00010     Mobilization     LS       1     382,250     382,250     809,000     809,000     704,000     704,000
    0040     0001     2021602/00010     Well Survey     EACH     60     500     30,000     2,150     129,000     1,600     96,000
    0050     0001     2031501/00040     Field Office Type D     EACH     1     6,367     6,367     4,000     4,000     25,000     25,000
    sub total:
    1610     0002     2401501/01143     Structural Concrete (1a43)     C Y      46     350     16,100     408     18,768     400     18,400
    1620     0002     2401501/01362     Structural Concrete (1c62)     C Y      68     200     13,600     204     13,872     200     13,600
    1630     0002     2401501/03643     Structural Concrete (3y43)     C Y      60     600     36,000     592     35,520     580     34,800
    1640     0002     2401512/03633     Bridge Slab Concrete (3y33)     S F      1,876     24     45,024     28     51,778     27     50,652
    1650     0002     2401521/00030     Structure Excavation Class R     C Y      17     125     2,125     1,000     17,000     500     8,500
    1660     0002     2401541/00010     Reinforcement Bars     LB       2,490     2     3,735     1     3,312     1     3,237
    1670     0002     2401541/00011     Reinforcement Bars (Epoxy Coated)     LB       12,380     2     18,570     1     17,703     1     17,332
    1680     0002     2401601/00010     Structure Excavation     LS       1     2,500     2,500     2,000     2,000     5,000     5,000
    1690     0002     2402583/00020     Ornamental Metal Railing Type Special     L F      284     150     42,600     194     55,096     190     53,960
    sub total
    1820     0003     2401513/00346     Type Curb Railing Concrete (3y46)     L F      135     25     3,375     16     2,093     15     2,025
    1830     0003     2401513/07447     Type Mod P-4 (Tl-4) Railing Conc (3y46)     L F      302     85     25,670     72     21,593     70     21,140
    1840     0003     2401541/00010     Reinforcement Bars     LB       14,780     1     18,475     1     13,598     1     13,302
    1850     0003     2401541/00011     Reinforcement Bars (Epoxy Coated)     LB       76,720     1     103,572     1     85,926     1     84,392
    1860     0003     2401601/00010     Structure Excavation     LS       1     10,000     10,000     116,000     116,000     115,000     115,000
    1870     0003     2402583/00020     Ornamental Metal Railing Type Special     L F      132     150     19,800     184     24,288     180     23,760
    sub total
    total

    You can accomplish that using decode with the grouping function. It returns 1 when that column passed as argument was grouped (or is in some total) and 0 otherwise.
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> with t as
      2  (select 'New York' city, 'US' country, 1 num from dual
      3  union all select 'Los Angeles' city, 'US' country, 2 num from dual
      4  union all select 'London' city, 'GB' country, 2 num from dual
      5  union all select 'London' city, 'GB' country, 2 num from dual
      6  union all select 'London' city, 'GB' country, 7 num from dual)
      7  select decode(grouping(country), 0, country, 'GRAND TOTAL') country,
      8         decode(grouping(city), 0, city, decode(grouping(country), 0, 'SUBTOTAL')) city,
      9         sum(num) num_total
    10   from t
    11  group by rollup(country, city)
    12  /
    COUNTRY     CITY         NUM_TOTAL
    GB          London              11
    GB          SUBTOTAL            11
    US          New York             1
    US          Los Angeles          2
    US          SUBTOTAL             3
    GRAND TOTAL                     14
    6 linhas selecionadas.
    SQL>

  • How to do running totals in a query

    Hi Guys, I have following data sample and desired output and I need a running total or subtotals on each row for two quntity fields on same row.
    Current data:
    ID - ---Day----- Qty1 Qty2
    Abc 04/01/2009 100 50
    abc 04/02/2009 70 20
    def 04/01/2009 10 30...
    Desired outPut:
    ID - ---Day----- Qty1 Subtoal Qty1 Qty2 SubtotalQty2
    Abc 04/01/2009 100 100 50 50
    abc 04/02/2009 70 170 20 70
    def 04/01/2009 10 180 30 30

    Hi,
    There's one thing in your example, regarding the last line:
    def 04/01/2009 10 180 30 30I assumed you meant:
    def 04/01/2009 10 180 30 100 <<== running total should be 100Am I correct?
    Then try:
    SQL> with t as (
      2  select  'Abc' col1, to_date('04/01/2009', 'dd/mm/yyyy') col2, 100 col3, 50 col4 from dual union all
      3  select'abc', to_date('04/01/2009', 'dd/mm/yyyy'), 70, 20 from dual union all
      4  select 'def', to_date('04/01/2009', 'dd/mm/yyyy'), 10, 30 from dual
      5  ) --Actual query starts here:
      6  select col1
      7  ,      col2
      8  ,      col3
      9  ,      sum(col3) over (order by rownum) rt_col3
    10  ,      col4
    11  ,      sum(col4) over (order by rownum) rt_col4
    12  from t;
    COL COL2             COL3    RT_COL3       COL4    RT_COL4
    Abc 04-01-2009        100        100         50         50
    abc 04-01-2009         70        170         20         70
    def 04-01-2009         10        180         30        100Edited by: hoek on Jun 24, 2009 5:19 PM added question

  • 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

  • Calculate total while designing query

    Hi All,
    I have a keyfigure purchase value . I am taking it in one column.
    Now I want to calculate total of purchase value for particular month.
    I can restrict time characteristic with variable but m not getting how to calculate total of this keyfigure.
    Please advise.
    Regards
    Shweta Goel

    what type of calculations?
    when you restrict a query by month you get the total in the result.
    if you want to use the purchase value for a month in a calculation, remove dates or order number from the query, have a aggregated result on which you can do the calculation and users can drill down if they need to see detail.
    regards
    Ramesh

  • Customised sub-total via UNION query - how to exclude from totals?

    Hi,
    I have a client requirement that a couple of companies have their own sub-total in a report, a treatment which applies to no other companies in their group.
    I have achieved this via a union all, but they also want a total of companies.
    Is there anyway to emulate a Grand Total, other than another union query such that the double count is not double counted?
    thanks for any ideas.
    Robert.

    only solution which i can think of is to create another union request for the grand total.. this way you wont add up your sub totals twice..

  • Total run time query

    Hi Gurus,
    I need to find out what is the total run time of a query in production. I browsed RSDDSTAT table in se11 but I don't know what is the name of the column to find out total run time.  Is it qruntimecategory ? Please advice .
    Thanks
    Liza

    Hi Liza,
    Goto ST03N transaction and select the expert mode and under BW system load you can check for the query you want. Here it gives the detailed view of the query. But to do this, the statistics for the cubes should have been enabled. for that, goto RSA1, tools-> BW statistics for the infoprovider and select your infoprovider and save. then run the query and you will see the result in ST03N.
    Sriram

  • Drill down by customer only for 1 year (only total then) in query designer

    Hello experts,
    I face a need I don't manage to fit with the query designer. It sounds easy, but I didn't find solution after few trials.
    The target report has to look like that :
           01.2010   02.2010   03.2010   04.2010   u2026   12.2010   Total
    Customer    
      cust 1        ratio          ratio         ratio          ratio    ratio     ratio     Total
      cust 2        ratio          ratio         ratio          ratio    ratio     ratio     Total
      cust 3        ratio          ratio         ratio          ratio    ratio     ratio     Total
      cust 4        ratio          ratio         ratio          ratio    ratio     ratio     Total
      cust 5        ratio          ratio         ratio          ratio    ratio     ratio     Total
      cust 6        ratio          ratio         ratio          ratio    ratio     ratio     Total
    Year 2010   total          total          total          total    total      total      total
         2009      total           total          total          total    total      total      total
         2008      total           total          total          total    total      total      total
         2007      total           total          total          total    total      total      total
    The particular point disturbing me is to display detailled ratio according to customer caractéristique ONLY for the current year (2010) and ONLY TOTAL for past years.
    Thanks in advance for help, points will be awarded.
    Guillaume

    Hi Petiaux,
    All the replies have been correct & all you need to do is a combination of a few. A step-by-step approach for your report, I'll explain in detail, and please correct me if I'm wrong.
    01.2010 02.2010 03.2010 04.2010 u2026 12.2010 Total
    Customer
    cust 1 ratio ratio ratio ratio ratio ratio Total
    cust 2 ratio ratio ratio ratio ratio ratio Total
    cust 3 ratio ratio ratio ratio ratio ratio Total
    cust 4 ratio ratio ratio ratio ratio ratio Total
    cust 5 ratio ratio ratio ratio ratio ratio Total
    cust 6 ratio ratio ratio ratio ratio ratio Total
    Year 2010 total total total total total total total
    So, the above is the first set of details you need to make. Follow up by using offsets for 1 variable followed up till the 12th month. Create a variable for 0CALMONTH (Cal Yr-Month) in a selection. Follow up by copying this variable 12 times, changing the offset of the input varaible to +1, +2, etc..
    Now for the next set as below, there are 2 approaches.
    2009 total total total total total total total
    2008 total total total total total total total
    2007 total total total total total total total
    1. If you are using i/p variable as Cal-Month, then its best you can approach to find the differences by making a selection for the same variable in a range like New Var (EnterMonth -12 : Enter Month -23 ). Same fashion, approach to calculate (EnterMonth - 24 : EnterMonth-35) etc. But limitations are there for this approach, as you need to select ranges & with each year you need to update the query.
    2. Use CELL Editor: At the top of the icon tray, you can notice a 'cell' symbol, wherein you can find the cell editor. Under the 2009, 2008, 2007 headings you can choose to create a selection with following restrictions: 0CALYEAR (Cal Year) as varaible. But the only thing here is the input variable for this query must be 2 seperate variables > One CALYEAR & another CALMONTH. So this is another approach, where user will have option to enter cal month & cal year seperately in 2 different text input boxes.
    3. Perform the calculation for 2010. Copy the same for 2009,2008,2007 etc with offsets. You can try hiding the rest of the month feilds, after calculating the total for all months of the years in 2009,2008 etc using offsets. Although it sounds crazy idea, but sometimes if customers require such an output we need to do something crazy though. I hope it might work, but as stated its the last option if nothing works out.

  • Display only total in a query

    Hello,
    i need to make a query that i want to show as a graph. But in the query there 's only the total i need to show and not all the details.
    Is there a way in a query to show only total or in a graph to use only the total of the corresponding query ?
    Thank's
    Thierry

    Thank for your answer.
    But i can't elimitate all characteristics from drilldown. I need to make a subtotal before calculating final result. The characteristic is set with the 'No display' property.
    I show the detail (only kf) for each value of characteristic.
    Thierry

  • Running Total & Distinct Count Query

    Crystal 10.0.0.533 CR Professional
    Hope you can assist.
    I have a report listing deals signed, each deal has a corresponding category i.e. industry type, Accountant, Chiropractor, Financial Services, etc.
    I am undertaking a Distinct Count on these categories so that in the group footer it is showing number of different categories signed in a period (the report is grouped into different date periods). This is working OK.
    However, I need to EXCLUDE the category from this distinct count if the deal value is zero.
    I have tried using a formula to show a blank field if the value is zero, however it appears to be distinctly counting the blank as a category?
    Any assistance would be much appreciated.
    Tracy

    Deffinetly it will be less than what you expect for grand total. It is because when you are calculating distinct count for each group suppose
    Group A has categories A,B,C,D-->distinct count (4)
    Group B has C,D,E,F-->distinct count (4)
    but while calculating grand total then the distinct count will be
    A,B,C,D,E,F --> grand total (6) but not (8).
    In this case you need to use mannual running total like this
    whileprintingrecords;
    numbervar i;
    i:=i+{running total};
    place this in group footer and create another fomula like this
    whileprintingrecords;
    numbervar i;
    place this in report footer to get the correct grand total.
    Regards,
    Raghavendra

Maybe you are looking for