Running avgs on group by

hi
i have small requirement on aggrigating functions. i hav 4 colums year, month, unitprice, running_avg on unitprice.
but in running avgs values integer value is 2 . it calculates before avgs . but i need year wise 2 running avgs means
it has break the values after change the year.
i hope u understand my requirement, anyone give response

HI john
U are giving very valuable information regarding OBIEE, Thank u forur research and presenting for us.
Here i have a doubt in the above question.
C'nu asked about the moving averages "MAVG"...... can u tell how it work for mavg for the same criteria.
Thanks & Regards
J Rushendra Prasad
Edited by: Rushi on May 13, 2010 3:19 AM

Similar Messages

  • SQL is running SLOW in group by

    Dear Experts,
    I have a query which is fetching around 2,603,675 records. When it is running without group clause it is running fine but as soon as Group by claused comes into picture it's dying. I have seent the plan which is correct and hitting to right indexs with right order. We have oracle 11g. Could some one please help me how to get rid of this? Below is the expaling plan for the same. Cost Bytes and Carfinality looks ok to me.
    Plan
    SELECT STATEMENT  HINT: ALL_ROWSCost: 1,363  Bytes: 304  Cardinality: 1                                                                   
         31 HASH GROUP BY  Cost: 1,363  Bytes: 304  Cardinality: 1                                                              
              30 NESTED LOOPS                                                         
                   28 NESTED LOOPS  Cost: 1,362  Bytes: 304  Cardinality: 1                                                    
                        25 NESTED LOOPS OUTER  Cost: 1,360  Bytes: 183  Cardinality: 1                                               
                             22 NESTED LOOPS  Cost: 1,359  Bytes: 168  Cardinality: 1                                          
                                  19 NESTED LOOPS  Cost: 1,357  Bytes: 121  Cardinality: 1                                     
                                       16 NESTED LOOPS  Cost: 1,356  Bytes: 107  Cardinality: 1                                
                                            13 NESTED LOOPS  Cost: 1,356  Bytes: 100  Cardinality: 1                           
                                                 6 NESTED LOOPS  Cost: 54  Bytes: 2,209  Cardinality: 47                      
                                                      2 TABLE ACCESS BY INDEX ROWID TABLE FDM.WH_SOURCES_D Cost: 2  Bytes: 16  Cardinality: 1                 
                                                           1 INDEX UNIQUE SCAN INDEX (UNIQUE) FDM.WSRC_UK1 Cost: 1  Cardinality: 1            
                                                      5 INLIST ITERATOR                 
                                                           4 TABLE ACCESS BY INDEX ROWID TABLE FDM.WH_ACCOUNTS_D Cost: 52  Bytes: 1,457  Cardinality: 47            
                                                                3 INDEX UNIQUE SCAN INDEX (UNIQUE) FDM.WACC_UK1 Cost: 50  Cardinality: 47       
                                                 12 PARTITION RANGE SINGLE  Cost: 1,356  Bytes: 53  Cardinality: 1  Partition #: 15  Partitions accessed #KEY(AP)                    
                                                      11 TABLE ACCESS BY LOCAL INDEX ROWID TABLE FDM.WH_ATM_BALANCES_F Cost: 1,356  Bytes: 53  Cardinality: 1  Partition #: 15  Partitions accessed #KEY(AP)               
                                                           10 BITMAP CONVERSION TO ROWIDS            
                                                                9 BITMAP AND       
                                                                     7 BITMAP INDEX SINGLE VALUE INDEX (BITMAP) FDM.WABF_BM6 Partition #: 15  Partitions accessed #KEY(AP)
                                                                     8 BITMAP INDEX SINGLE VALUE INDEX (BITMAP) FDM.WABF_BM10 Partition #: 15  Partitions accessed #KEY(AP)
                                            15 TABLE ACCESS BY INDEX ROWID TABLE FDM.T_SDM_GLPRODUCT Cost: 0  Bytes: 7  Cardinality: 1                           
                                                 14 INDEX UNIQUE SCAN INDEX (UNIQUE) FDM.TSGP_PK Cost: 0  Cardinality: 1                      
                                       18 TABLE ACCESS BY INDEX ROWID TABLE FDM.WH_PRODUCTS_D Cost: 1  Bytes: 14  Cardinality: 1                                
                                            17 INDEX UNIQUE SCAN INDEX (UNIQUE) FDM.WPRD_PK Cost: 0  Cardinality: 1                           
                                  21 TABLE ACCESS BY INDEX ROWID TABLE FDM.WH_COMMON_TRADES_D Cost: 2  Bytes: 47  Cardinality: 1                                     
                                       20 INDEX UNIQUE SCAN INDEX (UNIQUE) FDM.WCTD_PK Cost: 1  Cardinality: 1                                
                             24 TABLE ACCESS BY INDEX ROWID TABLE FDM.T_SDM_SECURITYINSTRUMENT Cost: 1  Bytes: 15  Cardinality: 1                                          
                                  23 INDEX UNIQUE SCAN INDEX (UNIQUE) FDM.TSSI_PK Cost: 0  Cardinality: 1                                     
                        27 PARTITION RANGE SINGLE  Cost: 1  Cardinality: 1  Partition #: 29  Partitions accessed #KEY(AP)                                             
                             26 INDEX RANGE SCAN INDEX (UNIQUE) FDM.WBKS_UK2 Cost: 1  Cardinality: 1  Partition #: 29  Partitions accessed #KEY(AP)                                        
                   29 TABLE ACCESS BY LOCAL INDEX ROWID TABLE FDM.WH_BOOKS_D Cost: 2  Bytes: 121  Cardinality: 1  Partition #: 29  Partitions accessed #1Edited by: BluShadow on 21-Oct-2011 08:57
    added {noformat}{noformat} tags. Please read {message:id=9360002} and learn to do this yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    user535789 wrote:
    Dear Experts,
    I have a query which is fetching around 2,603,675 records. When it is running without group clause it is running fine but as soon as Group by claused comes into picture it's dying. I have seent the plan which is correct and hitting to right indexs with right order. We have oracle 11g. Could some one please help me how to get rid of this? Below is the expaling plan for the same. Cost Bytes and Carfinality looks ok to me.I think you have a common misunderstanding there.
    Your original query did run fine fetching 2.6 million records?
    Usually such claims are only made when the query just returned the first few records (default 50 for tools like sql deeveloper or toad).
    How long did it take till you saw the very last record?
    If you add a group by then essentially you tell the database it has to do a sort operation over the whole dataset. Because it might be that the very last record has some information that would influence the first output row that is shown on the screen. Therefore the database has to read all the records including the very last one (no. 2,603,675) before it can show you one single output line. Same goes for all kind of sort operations, but the most typical are "Order by", "distinct", "group by", "union".
    My guess is that both queries take approximately the same time. You just don't know whow slow the original query was, becuase you saw some output rows while the query was still running.

  • I am running AVG software, but my emails are getting blocked by clamav software; why?

    I have a paid for version of AVG that is always running. I am getting emails rejected (only to one email address) with a message that states :
    This is the mail system at host mailrelay5.public.one.com.
    I'm sorry to have to inform you that your message could not
    be delivered to one or more recipients. It's attached below.
    <[email protected]> failed: letours.co.nz->MX:
    554 sorry, Infected message detected by ClamAV (#5.3.4)
    Reporting-MTA: dns; mailrelay5.public.one.com
    Received-from-MTA: smtp; [192.168.0.100] (112.120.88.44)
    Original-Envelope-Id: 25843d2e-536a-11e4-9123-b82a72d03b9b
    Arrival-Date: Tue, 14 Oct 2014 06:20:12 +0000
    Final-Recipient: rfc822; [email protected]
    Action: failed
    Status: 5.4.7 (Message could not be delivered in the allotted time frame)
    Remote-MTA: dns; letours.co.nz->MX
    Diagnostic-Code: smtp; 554 sorry, Infected message detected by ClamAV (#5.3.4)
    Received: from [192.168.0.100] (unknown [112.120.88.44])
    by smtpfilter2.public.one.com (Halon Mail Gateway) with ESMTPSA;
    Tue, 14 Oct 2014 06:20:06 +0000 (GMT)
    Message-ID: <[email protected]>
    Date: Tue, 14 Oct 2014 14:20:25 +0800
    From: Chris <[email protected]>
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2
    MIME-Version: 1.0
    To: [email protected], [email protected],
    Christopher <[email protected]>
    Subject: Testing emails again
    Content-Type: multipart/alternative;
    boundary="------------010001070905070002070703"
    Can anyone tell me why and what to do about it?
    Many thanks
    Chris

    petervan 58,
    Just this one person? Your .mac account is getting mail from others OK? Does the person have your email address correct on their phone.

  • Running total in group header doesn't display when it's at page bottom

    Post Author: Charles Denight
    CA Forum: Formula
    Hi, Using v.9 of Crystal Reports I've created some running totals using a cross-tab workaround to get the running totals into the group headers, but when the group header falls at the bottom of the page then the running total doesn't show up.Would appreciate knowing why and how to fix this.

    Replacing an item that is malfunctioning because of a manufacturing error is the bare minimum I would expect from customer service for any electronics item.
    The thing Apple does extremely well is their flat fee policy for repairs on their computers.
    I managed to break my MacBook pretty seriously (logic board needed to be replaced) and I'm sure it cost them more to repair the unit than the $328 they charged me.
    I probably would have been angry if it was something minor, but I'm guessing that most repairs to screens/motherboards/etc cost more than their flat fees.

  • Long Running Queries Using Group By & Order By

    I have his query and it takes forever to run. The TABLE 'term' has over a million rows and I think that the 'group by' and the 'Order By' together is killing the execution...
    Or is it due to the compute clauses.. I am at loss to understand the whole issue..
    Any ideas or thougts on how to solve this issue. Oracle Version is 8.1.6 ...
    Please help !!!!
    Thanx
    Rama
    ====================
    set pages 10000;
    set heading on;
    compute sum of total on area
    compute sum of total on report
    break on area skip 2 on report
    SELECT c.area area
    , b.modelcode model
    , count(1) total
    FROM leadterm a
    ,lead e
    ,term b
    ,temp_veh b
    ,leaddealer d
    ,dealer c
    WHERE
    a.leadid not in (select leadid from leadno_tmp)
    and a.leadid = e.leadid
    and a.termid = b.termid
    and e.leaddealerid = d.leaddealerid
    and ltrim(rtrim(d.vwdealercode)) = ltrim(rtrim(c.dealercode))
    group by c.area
    , b.modelcode
    order by to_number(c.area)
    , b.modelcode
    exit;

    Did you run this query through the explain plan yet?
    A few thoughts:
    - Order by is not needed, since group by automatically sorts the records.
    - Assuming that dealercode is a primary key, ltrim and rtrim functions will cause Oracle NOT to use indexes, but a full table scan. If a foreign key is defined, then ltrim and rtrim should not be necessary at all.
    - Instead of "not in" use "where not exists"

  • DISPLAY RUNNING TOTAL IN GROUP HEADER

    Post Author: sharonmtowler
    CA Forum: Formula
    I know there is a way to do this, just forgot how. i am in version 8.5.  i have a manual running total which calculates order qty for the entire sales order.i (dont like using the rt wizard-buggy)
    the knowledge base says to use a cross tab, but there hit or miss also.
    does anyone know how to show the display formula for a manual runnning total in the group header instead of group footer?

    Post Author: pandabear
    CA Forum: Formula
    Hi Sharon,
    I wanted to try this before I sent it to you, but my Crystal is down because (blah, blah, long story here....yawn....).
    I think I understand.  You want to show the "Total" for each group, in the group header instead of the group footer?
    My experience is that Crystal works from the top down (read: limiting), so I need a work around to do this.
    1 - Do the calculation in the query...sum by group, filter with a "Case" statement, etc.  If there's a reason you can't do that then
    2 - (and this is what I wanted to try first) see if you can group on the same field twice. 
    Group 1 - Test.field
    Group 2 - Test.field (same field)
    If you can,
    then just carry the total from the group footer of the previous group (same field) above you, and bring it down
    (shared var ?) to the group below.
    My 2 cents is up.
    Hope this helps,
    The Panda

  • Running Total in Group Header

    Post Author: bahamaER
    CA Forum: Crystal Reports
    Hello, I have been reviewing threads for running totals and would like some assistance on creating a running total for a group with a condition that will display in the group header, the running total should also reset for each group. Is this possible?
    I know that there are some constraints such as the variable being reset to 0 in the header for each group as well as the group records have not been rendered when the header formulas are being assessed. I have been able to accomplish the task of running totals with conditions for groups using a running total field and also 3 separate formulas placed in the group header, detail and footer. The display is only correct in the group footer; my goal is to have the footer formula in the group header.  Any ideas?  I am currently using CR 8.5 but will be upgrading to CR 2008.
    Thankyou

    Hi,
    If you are trying to calculate Total and display it in Group Header for field value placed in Detail, then you will get incorrect/no value for total, as Crystal Reports prints/processes the report line by line and it will not be able to process the Total for field in Detail section in Group Header.
    Its is by Design.
    For a workaround:
    - Insert the same probematic report (Say A.rpt) as a Subreport in Group Header of this report(Say A.rpt).(Say in GroupHeader A1) and link the Main Report to the
    - Insert Section Below (Say GroupHeader A2)
    - Calculate Total in Section Group Header A2)
    This workaround will reduce the Performance of the report as Subreport will be proceed for each Group Value.
    Regards,
    Kiran

  • Clubbing of PR through MRP run for same group items

    Presently PR's are generated under MRP for single line item. we required consolidation of the PR material group wise. is it possible? if yes, how? kindly suggest.

    Dear praneetsadekar ,
    If my understanding is correct then during MRP run it 's not possible to create single Purchase Req.for a list of materials that fall
    under same material group.
    check and revert back.
    Regards
    Mangalraj.S

  • Running total above Group

    Hey,
    I may be having a brain freeze.  I need to print a running total (max) above the detail lines of a report.  Since the running total is not known until after the detail lines, is there a way to do this?  I'm stuck and frustrated.  Thanks,
    Jim

    I'm starting to think I am going about this in the wrong way.  My report has a field named 'tolerance' which is on every other record but does not appear in the report detail.  It is the same value for every record in the group.  I need to capture the value and display it in the group header.  I was attempting to do a max() running total, and the field looked fine in the group footer, but when I copied it to the group header to changed to blank.
    I think there must be a simpler way to do this, but I don't know what it is.  Thanks for your help,
    Jim

  • Script to run only if group exists.

    Hello,
    I've done a few searches in the forums, but didn't locate what I was looking for.  Also tried Google with no luck.  Anyway, it's probably a simple request, but I can't seem to get it to work for anything.  What I'm looking for is an if statement that will check to see if a specific group exists in the default document before running it's script to bring in layers from another document.  Additionally, if there is also a way to check if a specific group (name) does not exist before running the code, as well.  Thanks in advance for any help.
    dgolberg

    This might help...
    if( layerExist("Layer 1")){
        alert("Layer/Group Exists");
        }else{
            alert("Layer/Group does not exist");
    function layerExist(lyrName){
          var desc = new ActionDescriptor();
          var ref = new ActionReference();
          ref.putName( charIDToTypeID( "Lyr " ), lyrName);
          desc.putReference( charIDToTypeID( "null" ), ref );
          desc.putBoolean( charIDToTypeID( "MkVs" ), false );
          try{
          executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );
          }catch(e){return false;}
          return true;

  • Weird data obtained when running Task: AD Group Lookup Recon

    Hi,
    Im running the scheduled task named: AD Group Lookup Recon
    It works. and populates the lookup named Lookup.ADReconciliation.GroupLookup
    but when lookin in the design console, the Code Key and the Decode values have weird data ie:
    code key: 2~CN=TelnetClients,CN=Users,DC=adtest,DC=com     
    Decode: ADITResource~CN=TelnetClients,CN=Users,DC=adtest,DC=com
    in the code key there is an extra *2~*
    in the Decode is an extra ADITResource~
    I may think that it is some kind of coding for connector commands used in provision tasks, when I'm trying to provision an OIM user to Active Directory (in the Organization Lookup field) i get this data
    this is just one line:
    Value: 2~CN={6AC1786C-016F-11D2-945F-00C04fB984F9},CN=Policies,CN=System,DC=adtest,DC=com      
    Description: ADITResource~CN={6AC1786C-016F-11D2-945F-00C04fB984F9},CN=Policies,CN=System,DC=adtest,DC=com
    Any Ideas?
    Thank You.

    yes you are right, code key and decode key is because of the coding in the connector to distinguish lookup values coming from multiple IT resources.
    If you want to get rid of this [IT Resource~] you will have to modify the connector.
    One more thing looks like the base dn you have specified for lookup reconciliation is DC=adtest,DC=com with generic filter thats why you are getting entries like 2~CN={6AC1786C-016F-11D2-945F-00C04fB984F9},CN=Policies,CN=System,DC=adtest,DC=com which may not be a group you want
    Hope this helps,
    Sagar

  • How to run a job group mult x per day M-F but only 1x on the weekend

    I currently have a job group that runs M-F, repeating several times each day. I'd like to now have this same group also run on Sat and Sun only once for these days. Is this possible on a single job group configuration or must I create a 2nd copy of the group and apply a weekend calendar with no repeat? I'm trying to avoid copying the group because I assume any changes I make to the group I'd then have to make twice? One approach I'm trying to figure out is if I can trigger the group to run on Sat and Sun via variable trigger and hoping this will not cause it to repeat in this case?

    Micheal
    What version are you running?
    In 5.31, what I would do is to have the main set M-F then use a different job (like a cmd echo or powershell write-host) on weekends that inserts the MF set at the time you want with a job event \ job insert action. This would override the time and execute when you want (you could probably just use one for  SAT, SUN). we do similar things to avoid maintenance windows.
    You might lose any downstream dependecies if the original is in a nested group but that might even work with a slight modification to the job depdency with the match occurance check box (relative to group, otherwise, for day) option
    It would be best if tidal let you add multiple calendars to one job, not sure if that is in the works but it should be on their radar.
    Marc

  • Running time for group process chain

    Hello Gurus,
             in our system, a group process chain includes a lot of process chains, after the whole group process chain runs through , how can I check how long it takes for  the whole group process  run?
    Many thanks.

    Hi,
    right click on start process of your meta chain..
    there you can find the start time of your meta chain.take that as A.
    go to last process of the chain and right click and take that time as B.
    The difference between the two times is your total meta chain runtime.
    hope this is clear for you.
    Regards
    Ramsunder

  • Running balance in grouped tablix??

    I am trying to add a running total to a tablix in RS 2008 and can't seem to get it working.
    Here is an example of what io want it to look like
    RENT
    Date             Description                      Amount       
    Balance
    01/01/2010   Balance brought forward  £-100.00       £-100.00
    01/01/2010   Debit                               £200.00       
    £100.00
    05/01/2010   Credit                              £100.00           £0.00
    01/02/2010   Debit                               £200.00       
    £200.00
    05/02/2010   Credit                              £100.00       
    £100.00
    01/03/2010   Debit                               £200.00       
    £300.00
    05/03/2010   Credit                              £100.00       
    £200.00
    NOW()          Balance carried forward                        £200.00
    COURT
    Date             Description                      Amount       
    Balance
    01/01/2010   Balance brought forward  £-20.00        £-20.00
    01/01/2010   Debit                               £10.00        £-10.00
    05/01/2010   Credit                              £10.00        £-20.00
    01/02/2010   Debit                               £20.00          
    £0.00
    05/02/2010   Credit                              £10.00        £-10.00
    01/03/2010   Debit                               £20.00        
    £10.00
    05/03/2010   Credit                              £10.00         
    £0.00
    NOW()          Balance carried forward                        £0.00
    COSTS
    Date             Description                      Amount       
    Balance
    01/01/2010   Balance brought forward     £10.00         £10.00
    01/01/2010   Debit                                 £50.00        
    £60.00
    05/01/2010   Credit                                £50.00         £10.00
    01/02/2010   Debit                                 £20.00        
    £30.00
    05/02/2010   Credit                                £20.00        
    £10.00
    01/03/2010   Debit                                 £30.00         £40.00
    05/03/2010   Credit                                £40.00          
    £0.00
    NOW()          Balance carried forward                           £0.00
    The tablix is grouped by category (eg RENT, COSTS, COURT) and I need to find out how to produce a running balance for each group and put the final palance as an extra row underneath.
    Any help would be fantastic!!

    Hello,
    Hello,
    You need to use a matrix control.
    Rows column is Date and columns are Description.
    So it will look like
    Balance brought forward
    Debit
    Credit
    Subtotal
    1/01/2010
    -100
    0
    0
    -100
    1/01/2010
    0
    200
    0
    200
    5/01/2010
    0
    100
    -100
    1/02/2010
    0
    200
    0
    200
    5/02/2010
    0
    0
    100
    -100
    01/03/2010 
    0
    200
    0
    200
    5/03/2010
    0
    0
    100
    -100
    Balance brought forward
    200
    Sergei

  • Macs can't see PC on home network running AVG Firewall

    I up graded to AVG 8.0 which runs a firewall on all the PC's. Before upgrading from 7.5 to 8.0 PC's could see Mac's and Mac's could see PC's.
    Now the PC's can see the Mac's and transfer files, but the Mac's can't see the PC's. Mac's can see Macs with know problem. I've been in contact with AVG but as of yet (3 month's) they have not given me a solution that works.
    I though I'd give this a try and see if some one has a solution.
    Note: 1 intel IMac G5 & a older G4

    Windows firewall just isn't beefy enough for me. This isn't a Hugh problem I can go to the PC's and transfer what I need. Just want it to work like it should. AVG
    has been great in the past, but this last upgrade is giving them problem.
    I know it should be a easy fix, and should be just a port opening, but every fix they send just doesn't do it. I'll keep trying and if I find the answer I'll post it here for everyone to see.
    Thanks

Maybe you are looking for

  • Pal/NTSC video to tv quest

    Hello, If I add some PAL formatted videos to my Zen Vision: M can I then play them on a TV by using the video hook-up cables? I know that US tvs use NTSC and cannot play Pal, but I am hoping that by first adding them to my Vision I can get the same q

  • Ssrs lookup funtion after update to SP2 (reporting services)

    Hi After updating to sql server 2012 sp2 build 11.00.5058 the lookup functions disrupts a tablix.<o:p></o:p> I Created a tablix with a column and row grouping. If I add a lookup function in an expression (in this case the value expression) The cell w

  • OPMN configuration assistant fails on Install

    We are installing B2B intergation and during the install the OPMN configuration Assistant Fails. The error description is Error --> Process (pid=2942) failed to start a managed process after the maximum retry limit Log: /home/oracle/MTProd/opmn/logs/

  • Question regarding documentation in a solution in the solution directory

    My understanding of SAP Solution Manager is that after the implementation project is finished the business process structure with the documentation objects  are moved to a solution. During the operational phase a support team can use this documentati

  • Tracing SQL in 10g

    Hi All, I have an application developed in .Net. It has lots of search screens what takes lot of time to search based on some criterias. I am accessing this from my client machine. My database is located in remote location and it has UNIX OS and Orac