Write a query for finding STDDEV for OLAP Cube

Can anybody post a sample query which will find the standard deviation of sales for each month in the sample GLOBAL OLAP schema for Oracle 11g.
The OLAP option automatically generates a set of relational views on cubes, dimensions, and hierarchies in Oracle 11g. So how can i write a query for finding the Standard deviation on these views.

The easiest way to do this is to do this directly within the AW using a custom calculated measure. In AWM11g you can use the 11g custom measure wrapper to execute the STDDEV function:
olap_dml_expression('function',data type)
For example
olap_dml_expression('STDDEV(cube_name, time_dimension_name)',number)
You can then simply expose this calculated measure as another column in your SQL View and then there is no need to use the SQL equivalent. This means the calculation is performed inside the AW (which is as close to the source data as you can get) ensuring performance of the whole query remains high.
If necessary you can take this a step further, if required, and wrap the STDDEV calculation within an OLAP DML program that would allow you to manipulate the status of time within the calculation. For example, you may want the STDDEV calc to only take into account the last 12 time periods rather than all time periods currently in status.
Hope this helps
Keith Laker
Oracle EMEA Consulting
OLAP Blog: http://oracleOLAP.blogspot.com/
OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
DM Blog: http://oracledmt.blogspot.com/
OWB Blog : http://blogs.oracle.com/warehousebuilder/
OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html

Similar Messages

  • Sql query to find dependencies for a table

    Hi All,
    I am having a table (REPT_ALL) with dependent objects on it ( child tables, indexes, constraints, views, synonyms, sequences , packages,procedures,functions,triggers).
    I want the query to find out all the above dependencies for the above table(REP_ALL).
    I m looking for the query to find dependencies inorder to find out the risks before dropping the above table(drop table REP_ALL cascade constraints)?
    Thnx

    To find foreign key constraints for a table you cannot use DBA_DEPENDENCIES but you have to use DBA_CONSTRAINTS.
    Example Re: Find out foreign key column

  • Can Excel 2011 for Mac connect to OLAP cubes ?

    I am trying to connect to an external source for Pivot Table data which is an OLAP Cube.  On my PC version of Excel I simply choose Data - From other Sources - From Analysis Services and away we go - this option does not appear to be available on the Mac verison of Excel 2011
    Does anyone know how I can overcome this?

    slavdo wrote:
    I’m using excel 2011 for Mac
    Then post your question on the Microsoft Mac forums since it's their software you're having issues with.  These forums are for troubleshooting Apple products.
    http://answers.microsoft.com/en-us/mac

  • HR Report for finding details for the new hires and leavers

    Dear All,
    I am very new to SAP HR ABAP.
    Need Help
    I have to create a report which fetches all the details <Details are mentioned below>
    for all the
    1)     New hires
    2)     Leavers
    in between a time range.
    <Details to be fetched :~ 
    Title
    Fax
    Mobile
    Nationality
    Domicile
    Religion
    Passport
    Place of issue
    Issue date
    Valid till
    Date of Hire
    Action Reason
    Reporting to
    Date of exit interview
    Leave Date
    Leaving Reason
    Street
    Address Line2
    City
    District
    Region
    Country
    Postal Code
    Communication Number
    Personal ID
    Date Of Last Hire
    Location
    Job
    Payroll area
    OrgLvl1
    OrgLvl2
    OrgLvl3
    OrgLvl4
    Personnel Number
    Date of seniority
    EEBankName
    Bank account no
    Bank account type
    PERID
    Thanks a lot !!!
    Joy
    Edited by: joydip majumder on Jul 11, 2008 10:46 AM

    Hi  joy ,
    you can create ur own z-report for this requirement  , for this u have to  read the  employee data with in the date rage for   infotype 0 (Action) for hiring and leaving dates. Other related infomation  u can fetch from the related infotypes tables like PA0001 etc using simple select queries.All required fields can be dispalyed in the  ALV output.
    Regards
    Lakhan
    Edited by: lakhan on Jul 11, 2008 2:35 PM

  • OLAP help: How to query a table in a OLAP cube

    Hello,
    I'm completely new in OLAP (even if I participated to cube creations), and I think a know well PLSQL.
    We are on 10g v2.
    OLAP cubes have been created with dimensions and tables.
    It's possible to see and use the cubes under the AWM
    I would like to know if it's possible to access a table within a cube directly from SQLPlus?
    I thought about querying table all_objects ... but I didn't see anything good !!
    I am stuck !!
    Are the cubes saved in the same DB as the relational standard objects ?
    I hope that you can give me some help... or provide me with good URLs ...
    Thanks in advance,
    Olivier

    Hello Maxim,
    Thanks for your reply..
    I looked at the doc you gave, and also I am now able to get the names of cubes and dimensions :
    The cubesselect aw_owner||'.'||aw_name||'!'||aw_logical_name cube
    from olapsys.ALL$OLAP2_AW_CUBES
    order by cube;
    The dimensionsselect aw_owner||'.'||aw_name||'!'||aw_logical_name dimension
    from olapsys.ALL$OLAP2_AW_DIMENSIONS order by dimension;
    So, I start to figure out where I would like to go ...
    But, in the doc, there is a lot of CREATE commands ....
    I'm puzzled !! ... Do I have to create objects in sqlplus (views or something else) prior to query a table ?
    Also, when I see the dimensions in table olapsys.ALL$OLAP2_AW_DIMENSIONS ...
    Is it possible to DESC these "tables" or make a SELECT ?
    Thanks,
    Olivier

  • Write a query / pl/sql statement for desired results

    Here is the table data:
    FSSETY FSUSER FSOBNM FSA FSCHNG FSDLT FSIOK FSICPY FSATN1
    1 DSTEIN P0030A N N N Y N Y
    1 FINAB001 P0030A Y Y Y Y Y Y
    1 FINAB001 P01012 Y Y Y Y Y Y
    1 DSTEIN P01012 Y Y Y Y Y Y
    1 DSTEIN P01013 Y Y Y Y Y Y
    1 FINAB001 P01013 Y Y Y Y Y Y
    1 FINAB001 P0111 Y Y Y Y Y Y
    1 DSTEIN P0111 Y Y Y Y Y Y
    1 DSTEIN P01111 Y Y Y Y Y Y
    1 FINAB001 P01111 Y Y Y Y Y Y
    1 FINAB001 P0115 Y Y Y Y Y Y
    1 DSTEIN P0115 Y Y Y Y Y Y
    1 DSTEIN P01BDWRD Y Y Y Y Y Y
    1 FINAB001 P01BDWRD Y Y Y Y Y Y
    1 FINAB001 P0411 Y Y Y Y Y Y
    1 DSTEIN P0411 N N N Y N Y
    What I need in results is:
    For each FSOBNM, return the rows with different FSUSER values and non-matching values in fsa OR fschng OR fsdlt OR fsicpy.
    So, the desired output of the query should return the first two rows and the last two rows, as they meet this criteria.
    I need help in the statement that would return the desired results.
    Thanks!
    Edited by: skyfox on 17-May-2012 5:54 PM
    Edited by: skyfox on 17-May-2012 5:54 PM

    Hi Skyfox,
    Below is the query you might be looking into
    SQL>
    SQL> WITH test AS(
      2  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P0030A' FSOBNM, 'N' FSA, 'N' FSCHNG, 'N' FSDLT, 'Y' FSIOK, 'N' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      3  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P0030A' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      4  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P01012' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      5  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P01012' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      6  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P01013' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      7  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P01013' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      8  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P0111' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      9  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P0111' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    10  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P01111' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    11  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P01111' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    12  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P0115' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    13  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P0115' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    14  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P01BDWRD' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    15  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P01BDWRD' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    16  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P0411' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    17  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P0411' FSOBNM, 'N' FSA, 'N' FSCHNG, 'N' FSDLT, 'Y' FSIOK, 'N' FSICPY, 'Y' FSATN1 FROM DUAL)
    18  SELECT *
    19    FROM test a
    20   WHERE EXISTS (SELECT 1 FROM test
    21                  WHERE fsobnm = a.fsobnm
    22                    AND fsuser != a.fsuser
    23                    AND (fsa != a.fsa OR fschng != a.fschng OR fsdlt != a.fsdlt OR fsicpy != a.fsicpy))
    24  /
        FSSETY FSUSER   FSOBNM   FSA FSCHNG FSDLT FSIOK FSICPY FSATN1
             1 DSTEIN   P0030A   N   N      N     Y     N      Y
             1 FINAB001 P0030A   Y   Y      Y     Y     Y      Y
             1 FINAB001 P0411    Y   Y      Y     Y     Y      Y
             1 DSTEIN   P0411    N   N      N     Y     N      Y
    SQL>

  • How to write the query to find the duplicate rows?

    Hi,
    How will I find the duplicate rows in the table?
    I have a table called ITEM
    Select item_no,mfg_id from item
    Item Mfg_ID
    178 06278
    178 06589
    238 5489
    289 7895
    289 7596
    Now I want to find only the duplicate rows i.e.,178 & 289 is coming twice.
    How will get the all duplicate rows in the table?

    nihar2 wrote:
    Convert to
    SELECT it.item,
         im.mfg_item,
         im.manufacturer,
         im.description
    FROM (SELECT it.item,
         im.mfg_item,
         im.manufacturer,
         im.description,
         count(it.item) over(partition by it.item order by it.item) cnt
         FROM item it,item_mfg im
         WHERE it.u##item=im.u##item)
    WHERE cnt > 1
    But I tried It show not valid identifier.You can't use the table aliases from the sub-query...
    SELECT item,
           mfg_item,
           manufacturer,
           description 
    FROM (SELECT it.item,
           im.mfg_item,
           im.manufacturer,
           im.description,
           count(it.item) over(partition by it.item order by it.item) cnt
      FROM item it,item_mfg im
      WHERE it.u##item=im.u##item)
    WHERE cnt > 1

  • Need helping in writing query for finding percentage of duration

    Can any one please help in writing query for this.
    The table is like this :-
    ID     Region     Month     Duration
    I1 R1     Jan     80
    I2     R2     Jan     70
    I3     R1     Jan     70
    I4     R3     Jan     40
    I5     R1     Feb     80
    I6     R2     Feb     30
    I7     R3     Mar     100
    I want to write a query to find
    % of duration for each and every region against each and every month.
    Please help in solving this query. I am in urgent need of this.
    Thanks in advance.

    I also have to do in MS Access 2003You also have to ask into an other forum since here it's an Oracle forum, to try to find Oracle solution.
    Nicolas.

  • Write a query to get the users those are not appliyed for the exam?

    hi frz i have two tables like User,UserHistory
    User table contains clmns--Uid,Uname
    UserHistory contain columns--Uid,Course,Status.
    so i want to write a query to find out those are not applied for the particlur course i want to found only those records from the two tables...

    Hello,
    The SQL Server forums are over here:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/home
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?&lt;=\G.{2})'|%{if($_){[char][int]&quot;0x$_&quot;}})

  • SQL query to find out last login for each database

    Hi everybody,
    I have a view with following columns:
    DatabaseSid, lastLogin, firstLogin.
    I want to now the newest last_login date for every database.
    SID First Login Last Login
    e.g. Database1, 11.11.2011, 01.12.2011
    Database1, 01.04.2012, 01.05.2012
    Database3, 03.03.2004, 03.06.2005
    Database 3 07.09.2012, 12.10.2012
    How can I do a query to find out for eacht DB (DB1, DB2 and so on) the Last_Login Date?
    Thank you in advance
    Steve

    Steve wrote:
    Hi everybody,
    I have a view with following columns:
    DatabaseSid, lastLogin, firstLogin.
    I want to now the newest last_login date for every database.
    SID First Login Last Login
    e.g. Database1, 11.11.2011, 01.12.2011
    Database1, 01.04.2012, 01.05.2012
    Database3, 03.03.2004, 03.06.2005
    Database 3 07.09.2012, 12.10.2012
    How can I do a query to find out for eacht DB (DB1, DB2 and so on) the Last_Login Date?
    Thank you in advance
    SteveI'm curious as to how you collect this information from multiple databases into one database, and of what value the data is once you have it.

  • Finding BAPI for  inbound Delivery change(VL32N)

    HI,
    Plz help me For finding BAPI for  inbound Delivery change(VL32N).
    I have to pass delivery no as input parameter and should able to change shipment heder information
    like Special processing indicator.
    REGARDS,
    Sunil Sahoo.

    hi ,
    there are three  BAPI  your requirment
    1) BAPI_INB_DELIVERY_CONFIRM_DEC
    2) BAPI_INB_DELIVERY_SAVEREPLICA
    3) BAPI_INB_DELIVERY_CHANGE
    but for requirment
    The third BAPI
    BAPI_INB_DELIVERY_CHANGE
    will Sound promising. try this out
    regards
    Prashant

  • Can't find options for printing without color!?

    Any ideas for finding options for black and white printing on an iMac 10.7?  I don't want to waste the color cartridge.

    I've been working on Macs since OS6. Just moved all the way from Tiger to Lion. Seamless aparrt from printing Black and White. I have a few thousand CAD files which I print regularly. They're drawn in various colours on a black screen but obviously when I print them I want them in Black & White. Not Greyscale.
    Previously I've hacked around this using a custom Quartz filter which I can no longer select from the Print dialog. Save in Preview, apply a filter, reopen and print? A few hundred times? Not very helpful.
    I tried setting up an Automator print workflow but it baulks at the printer by sending a Letter format file not the A3 or A4 that's in the original Print Setup dialog.
    Oh - the printer is a Xerox Workcentre 7425.

  • A better way to write last_day query

    Hi folks,
    I am looking for a better way to write a query to find last_day in month but if its sunday or holiday it should move to day before last day.
    So for example if 31 is sunday it should go for 30, if 30 is holiday it should move down to 29.
    I got this so far but the connect by level is hardcoded to 15. Want to see if there is a better way to get this working:
    select max(datum)
      from (    select last_day(trunc(sysdate)) - level + 1 as datum
                  from dual
            connect by level < 15)
    where to_char(datum, 'day') != 'sunday'    
       and to_char(datum, 'DDMM') not in
             ('3012')Best regards,
    Igor

    Like this
    select to_char(last_day_month, 'Day') day_is,
           last_day_month,
           last_day_month - case when to_char(last_day_month, 'fmday') = 'sunday' then 1
                                 when to_char(last_day_month, 'ddmm' ) = '3012'   then 1
                                 else 0
                            end last_business_day_month
      from (
              select last_day(add_months(trunc(sysdate, 'year'), level-1)) last_day_month
                from dual
              connect by level <= 12
    DAY_IS    LAST_DAY_MONTH LAST_BUSINESS_DAY_MONTH
    Tuesday   31-JAN-12      31-JAN-12              
    Wednesday 29-FEB-12      29-FEB-12              
    Saturday  31-MAR-12      31-MAR-12              
    Monday    30-APR-12      30-APR-12              
    Thursday  31-MAY-12      31-MAY-12              
    Saturday  30-JUN-12      30-JUN-12              
    Tuesday   31-JUL-12      31-JUL-12              
    Friday    31-AUG-12      31-AUG-12              
    Sunday    30-SEP-12      29-SEP-12              
    Wednesday 31-OCT-12      31-OCT-12              
    Friday    30-NOV-12      30-NOV-12              
    Monday    31-DEC-12      31-DEC-12 

  • Need query to find rows

    hi
    i need query to find out for one perticular row from parent table ,,which references how many rows in how many child tables , and child to child tables. in herirachy fashion.
    if anybody know please help me

    I guess it would be difficult to come up with a generic script to get answer that can help in all situations...you have to see the table definitions in your schema and try...like in case of emp and dept table,
    select * from dept where deptno in
    (select deptno,count(*) from emp group by deptno having count(*)>1)
    (this gives rows from dept table where , for corresponding deptno there are more than one rows in emp table).
    Thanks
    Nirav

  • SQl query to find incompatibility defined

    If two programs are defined as incompatible with one another, the data these programs cannot access simultaneously must also be identified.
    This can be found from concurrent program->define from front end ebs login, but is there any SQL query to find this for a particular program or request set??
    Thanks in advance.

    Please search the forum before posting similar questions.
    Concurrent-Conflict
    Re: Concurrent-Conflict
    Thanks,
    Hussein

Maybe you are looking for

  • Did you know that the software purchased from the App Store could be an old version?

    Today I purchased Adobe Photoshops Elements fro the App Store.  I never thought to check the version number, it never crossed my mind that could be the old version I was buying.  Apparently the latest version available on the App store is version 10

  • Pavilion 500 VGA

    I have recently purchased a Pavilion 500-141ea desktop PC. It works fine exept that I can't find a VGA port. I am currently using the standard Pavilion 23xi monitor but wish to add a hp pavilion f1723 monitor to my arsenal. I would really enjoy some

  • Upgrading to 10.5

    I just bought my fiance an apple as his college grad present. Problem is, it runs 10.3 Panther, and we want to install the 10.5.4 Leopard so that we can run Adobe Creative Suite 4. The computer is an iMac G4 800MHz/512MB/60GB Can I even do this with

  • Flash Player ActiveX Failure... Flash Gallery

    I can not watch my web-sites made with LR - "flash-gallery" anymore, before I have uninstalled The Flash Player; and re-installed it again, but as soon I have restarted my computer: The same problem! (and the links do not work proberly) I run Vista a

  • I've updated my trial version of muse to a paid version and it still won't let me let my site go live! Can someone help me?

    I want to publish the site that I just made and it said that it won't go live until I have a paid membership. So then I paid for a membership and when I go to manage the site and click launch site it still says it's on the trial version. Will someone