Building OLAP Cubes

Embed Size (px)

Citation preview

  • 8/11/2019 Building OLAP Cubes

    1/88

    Building OLAP Cubes

    Topics

  • 8/11/2019 Building OLAP Cubes

    2/88

    Overview

    AWM is a tool for creating, developing, and managing multidimensional data in an Oracle data warehouse. With this easy-to-use GUItool, you create the container for OA! data, an analytic wor"space #AW$, and then add OA! dimensions and cu%es.

    In Oracle OA!, a &u%e provides a convenient way of collecting stored and calculated measures with similar characteristics, includingdimensionality, aggregation rules, and so on. A particular AW may contain more than one cu%e, and each cu%e may descri%e a different

    dimensional shape. Multiple cu%es in the same AW may share one or more dimensions. 'herefore, a cu%e is simply a logical o%(ectthat helps an administrator to %uild and maintain data in an AW.

    After creating cu%es, measures, and dimensions, you map the dimensions and stored measures to e)isting star, snowfla"e, andnormali*ed relational sources and then load the data. OA! data can then %e +ueried with simple .

    ac" to 'opic ist

    Scenario

    'he source data for this tutorial the OA!'/AI0 schema. OA!'/AI0 is a star schema that was sourced from a %ase transactionalsystem which contains data for a fictional electronics store. 'he star schema contains 1dimension2 ta%les, which descri%e the

    relationships in the data, and 1fact2 ta%les, which contain the metrics used to measure performance.

    'he following are the ta%les, intended for analysis, that previously have gone through the 3' #3)traction, 'ransformation, and

    oading of heterogeneous data$ process4

    Table Description

    &5A003 'a%le containing distri%ution channels for customers purchases.

    &U'OM3/'a%le that show who purchased products, and where products are sold for the

    Geography dimension.

    !/O6U&' 'a%le containing products that are sold %y the company.

    'IM3 'a%le containing time periods when products were sold.

    A378A&' tores purchases in dollars, +uantity, and price, %y channel of distri%ution,

    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#t
  • 8/11/2019 Building OLAP Cubes

    3/88

    product item, day, and customer.

    Designing a Logical Data Model

    After e)amining the relational ta%les, the availa%le levels, hierarchies, and attri%utes for each dimension are identified. In addition, there+uired stored and calculated measures are identified as part of the %usiness re+uirements definition process. 'he resulting logicalmodel %ecomes the design for the OA! data model.

    Identifying Diensions

    Using the source data ta%les as the primary input, the following dimensions have %een identified as re+uirements for the OA! datamodel4

    &hannel

    Geography

    !roduct

    'ime

    Identifying Levels

    When designing your OA! model, you also determine the level of summari*ation that you want to load into your cu%e. 9ou may notnecessarily want to replicate the data in your source as a cu%e. 9ou can always +uery the detail data #since all of the data is in the

    Oracle data%ase$, %y (oining the cu%e to the fact ta%le.

    9our %usiness re+uirements for summary management and analysis purposes should define the lowest level of detail for each

    dimension in the OA! cu%e. 9ou can load data into the cu%e at any level. After performing a %usiness re+uirements analysis, thefollowing the levels of summari*ation within each dimension have %een identified as part of the OA! data model4

  • 8/11/2019 Building OLAP Cubes

    4/88

    C!annel diensionhas two classes of distri%ution channels4 6irect and Indirect. 'he children of these two values are the lowest

    level of detail and will %e grouped in the &hannel level. 8rom the order of highest level of summari*ation to the lowest level of

    detail, levels will %e4 All C!annels" Class" andC!annel.

    #eograp!y diensionreflects how company performs customer and geographic analysis along regions. Although the

    &U'OM3/ dimension ta%le contains the following levels of detail4 /egion : &ountry : tate-!rovince : &ity : &ustomer, thelevels of summari*ation re+uired for geographic analysis in the OA! system will %e #highest to lowest$4 All $egions" $egion"

    Country" and State%Province.

    Product diensionwill have si) levels. 'hese levels reflect the same levels of detail in the source data. 8rom highest to lowest, theOA! levels are4 All Products" Departent" Category" Type" Subtype"andIte.

    Tie diensionwill have four levels #highest to lowest$4 All &ears" Calendar &ear" Calendar 'uarter" andMont!. 6ata is

    availa%le for the years ;

  • 8/11/2019 Building OLAP Cubes

    5/88

    ales 9ear-to-6ate !rior 9ear

    ales 9ear-to-6ate !rior 9ear &hange

    ales !rior 9ear &hange

    ales !rior !eriod

    ales !rior !eriod &hange ales /an" in !roduct evel

    ales /an" in !roduct !arent

    hare of !roduct ales within !arent

    hare of !roduct ales within 'otal

    ac" to 'opic ist

    Prere)uisites

    efore you perform this tutorial, you should4

    *+ Install Oracle 6ata%ase BB.; or B;.B with the OA! Option.

    ,+ 6ownload Analytic Wor"space Manager from the Oracle OA!page on O'0, and un*ip it intoany directory on your Windows machine.

    C. 6ownload and install the OA!'/AI0 schema following the instructions in Installing the

    Oracle OA! BBg ample chema.

    0otes4 'he ample chema installation pac"age includes two parts4

    B. Installing the %ase OA!'/AI0 schema

    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://www.oracle.com/technetwork/database/options/olap/index.htmlhttp://www.oracle.com/technology/products/bi/olap/11g/samples/schemas/readme.htmlhttp://www.oracle.com/technology/products/bi/olap/11g/samples/schemas/readme.htmlhttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://www.oracle.com/technetwork/database/options/olap/index.htmlhttp://www.oracle.com/technology/products/bi/olap/11g/samples/schemas/readme.htmlhttp://www.oracle.com/technology/products/bi/olap/11g/samples/schemas/readme.html
  • 8/11/2019 Building OLAP Cubes

    6/88

    ;. Installing the A3'/A&D analytic wor"space in the OA!'/AI0 schema

    0O'34 Only complete the first part -- installing the %ase OA!'/AI0 schema.

    8I/' !A/' I0'AA'IO04

    Oracle OA! BBgample chema

    ample chema Installation Instructions

    'his document e)plains how to install the sample schema that is used for Oracle OA! BBgcollateral4 Oracle %y 3)amples, samples, etc. 'he installation must ta"e place on the same

    computer that contains Oracle 6ata%ase BBg. 'he user performing the installation must have

    6A privileges.

    'here are two parts to the installation4

    B. Install the %ase @OA!'/AI0@ schema that contains the source data for the cu%e

    ;. &reate the cu%es that are derived from the source data

    9ou will always need to perform step B - which installs the %ase schema. Only perform step ; ifyou are not interested in learning how to %uild cu%es #e.g. you do not plan to do the Oracle %y

    3)ample that shows how to create cu%es using Analytic Wor"space Manager$.

    oftware /e+uirements

    Oracle 6ata%ase BBg #patch BB.B.

  • 8/11/2019 Building OLAP Cubes

    7/88

    ;. &reates the OA!'/AI0 user #and drops the user if it already e)ists$

    C. Uses Oracle 6ata !ump to import the information found in the included dump file

    E. #Optional$ &reates the A3'/A&D analytic wor"space containing the sales and

    forecast cu%e in the OA!'/AI0 schema #and drops the analytic wor"space if it alreadye)ists$. 'he data will %e loaded and aggregated.

    Installing the %ase OA!'/AI0 schema

    B. &reate a directory on the computer where Oracle 6ata%ase BBg is installed. 'his directory

    will %e referred to as Finstall7home;. 6ownloadand un*ip olaptrain7install.*ip into this directory

    C. &hange to the Finstall7homeHolaptrain7install directory

    E. og in to !lus as a d%a user

    =. 3nsure that there are no e)isting OA!'/AI0 users connected to the data%ase.

    Otherwise, the attempt to drop the user will fail.

    J. At the !lus prompt, run Kinstall7olaptrain. 8ollow the directions at the !lus

    prompts

    8or e)ample4

    : cd Finstall7homeHolaptrain7install: s+lplus H as sysd%a

    : Kinstall7olaptrain

    'his procedure installs the OA!'/AI0 schema for the Oracle OA! BBg

    training class, samples and Oracle %y 3)amples.

    B. 9ou should %e logged on as a 6A to e)ecute this procedure.

    http://download.oracle.com/otndocs/products/warehouse/olap/olaptrain_install.ziphttp://download.oracle.com/otndocs/products/warehouse/olap/olaptrain_install.zip
  • 8/11/2019 Building OLAP Cubes

    8/88

    ;. 3nsure any e)isting OA!'/AI0 user sessions are disconnected %efore proceding

    with the installation #this install will recreate the user if it e)ists$

    3)ample4c4LdownloadLolaptrain7install or HhomeHoracleHolaptrain7install

    6irectory4 Finstall7homeHolaptrain7install

    pecify a password for the OA!'/AI0 user.!assword4 password

    Installing the A3'/A&D analytic wor"space in the OA!'/AI0 schema

    B. 3nsure no user has an e)isting A3'/A&D analytic wor"space open in theOA!'/AI0 schema #it will %e recreated$.;. &hange to the Finstall7homeHolaptrain7install directory

    C. og in to !lus as a d%a user

    E. At the !lus prompt, run Kcreate7olaptrain7cu%es. 8ollow the directions at the

    !lus prompts

    'he cu%es and dimensions are now availa%le for +uery.

    8or e)ample4

    : cd Finstall7homeHolaptrain7install: s+lplus H as sysd%a

    : Kcreate7olaptrain7cu%es

    pecify file system directory containing this installation program.

  • 8/11/2019 Building OLAP Cubes

    9/88

    3)ample4

    c4LdownloadLolaptrain7install or HhomeHoracleHolaptrain7install

    6irectory4 Finstall7homeHolaptrain7install

    pecify a password for the OA!'/AI0 user.

    !assword4 password

    E. a. 6ownload olaptrain7templates.*ipto a location on the machine where AWM is installed.

    %. Un*ip the files.

    'he resulting directory structure is4 \templates\calcs

    'he files in the +++-teplatesdirectory, and the+++-teplates-calcsdirectory are used later in this

    tutorial.

    ac" to 'opic ist

    Creating an Analytic .or/space

    An analytic wor"space is a container for multidimensional data o%(ects and procedures written in OA! 6M. It is created using the

    AWM tool. !erform the following steps4

    *+ aunch AWM either %y dou%le-clic"ing on the awmBB.;.

  • 8/11/2019 Building OLAP Cubes

    10/88

    ,+ /ight-clic" Databasesand selectAdd Database to tree.

    0+ 3nter Oraclein the 6escription field and 1!ostnae23*4,*31SID2in the &onnection

    Information field and clic" Create.

  • 8/11/2019 Building OLAP Cubes

    11/88

    5+ &lic" the !lus sign #$ ne)t to Oracle.

    4+ 3nter olaptrainas the Username and oracleas the !assword. 'hen clic" O6.

  • 8/11/2019 Building OLAP Cubes

    12/88

    7+ 3)pand Sc!eas 2 OLAPT$AI8. /ight-clic" Analytic .or/spacesand select Create

    Analytic .or/space.

    9+ 3nter SAL:ST$AC6as the 0ame and clic" Create.

  • 8/11/2019 Building OLAP Cubes

    13/88

    ;+ 9our Analytic Wor"space has %een created.

    ac" to 'opic ist

    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#t
  • 8/11/2019 Building OLAP Cubes

    14/88

    Defining Diensions and Levels

    6imensions are lists of uni+ue mem%ers that identify and categori*e data. 'hey form the edges of a cu%e, and thus the measures withinthe cu%e. 6imensions may contain levels, hierarchies, and attri%utes. 9ou may define levels at the same time that create a dimension,

    or you may define the levels later.

    9ou can define dimensions either as NUserN or as N'imeN dimension type. usiness analysis is performed on historical data, so fully

    defined time periods are vital. 8or a 'ime type dimension, your source data must have columns for period end dates and time span.'hese re+uired attri%utes support OA! time-series analysis, such as comparisons with earlier time periods. If this information is not

    availa%le, then you can define 'ime as a normal dimension, %ut it does not support time-%ased analysis.

    *+ /ight-clic" the Diensionsfolder and select Create Diension.

    ,+ At the default General ta% in the &reate 6imension dialog %o), enter C(A88:Las the nameand select

  • 8/11/2019 Building OLAP Cubes

    15/88

    0+ In the evels ta%, enter the following three levels4

    ALL=C(A88:LS

    CLASS

    C(A88:L

    0ote4 the a%el and 6escription fields are auto-filled

  • 8/11/2019 Building OLAP Cubes

    16/88

    5+ In the Implementation 6etails ta%, select

  • 8/11/2019 Building OLAP Cubes

    17/88

    ac" to 'opic ist

    Defining (ierarc!ies

    8or %usiness analysis, data is typically summari*ed at various levels. 8or e)ample, your data%ase may contain daily snapshots of atransactional data%ase. 6ays are thus the %ase level. 5owever, you might summari*e this data at the monthy, +uarterly, and yearly

    levels.

    A hierarchy is a logical structure that uses ordered levels as a means of organi*ing data. It can %e used to define data aggregation fore)ample, in a time dimension, a hierarchy might %e used to aggregate data from the month level to the +uarter level to the year level. Ahierarchy can %e used to define a navigational drill path, regardless of whether the levels in the hierarchy represent aggregated totals.

    6imensions can have one or more hierarchies. If you define multiple hierarchies, one of them must %e defined as the default hierarchy.

    *+ /ight-clic" the (ierarc!iesfolder, then select Create (ierarc!y+

    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#t
  • 8/11/2019 Building OLAP Cubes

    18/88

    ,+ In the &reate 5ierarchy window, enter SAL:S=C(A88:Las the name. &lic" the Add All #::$

    tool to select all the levels and clic" Create.

  • 8/11/2019 Building OLAP Cubes

    19/88

  • 8/11/2019 Building OLAP Cubes

    20/88

    0+ 'he new A37&5A003 hierarchy appears as an item in the 5ierarchies folder.

    ac" to 'opic ist

    Defining and $eviewing Attributes

    Attri%utes provide information a%out the individual mem%ers of a dimension. 'hey are used for la%eling data displays and selecting

    data. All dimensions are created with long and short description attri%utes. 'ime dimensions also have time-span and end-date

    attri%utes. In addition, you can create your own user attri%utes

    In this section, you create a &5A0037'9!3 attri%ute, and also review the description attri%utes for the &5A003 dimension you(ust created. !erform the following steps4

    *+ /ic"-clic" the Attributesfolder, then select Create Attribute.

    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#t
  • 8/11/2019 Building OLAP Cubes

    21/88

    ,+ In the &reate Attri%ute dialog, select or enter the following4

    a. 0ame P C(A88:L=T&P:

    %. Attri%ute 'ype P

  • 8/11/2019 Building OLAP Cubes

    22/88

    &lic" Create.

  • 8/11/2019 Building OLAP Cubes

    23/88

    0+ 3)pand the Attributesfolder to view the &hannel dimension attri%utes.

    5+ elect the LO8#=D:SC$IPTIO8attri%ute. In the right-hand pane, notice that descriptionattri%utes are defined for all levels in the hierarchy, in contrast to the user attri%ute that you (ust

    created..

  • 8/11/2019 Building OLAP Cubes

    24/88

    ac" to 'opic ist

    Mapping Diensions to $elational Sources

    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#t
  • 8/11/2019 Building OLAP Cubes

    25/88

    After creating OA! data o%(ects, you map them to ta%les and views in Oracle 6ata%ase. 9ou map the "ey column in the dimension

    ta%le to the Mem%er attri%ute in the OA! dimension. In addition, you map the appropriate attri%ute columns in the dimension ta%le to

    the associated OA! dimension attri%utes.

    Afterward, you can load data into your analytic wor"space using the Maintain Analytic Wor"space wi*ard.

    *+3)pand the C(A88:Ldimension and clic" Mappings+

    /esult4 'wo panes appear to the right4 of the navigator -- the chemas pane, and the Mapping pane. In the

    'a%le Mapping view #right-hand pane$, the ource &olumn fields are initially %lan", as shown here4

  • 8/11/2019 Building OLAP Cubes

    26/88

    ,+3nsure that Star Sc!eais selected as the 'ype of 6imension 'a%le, as shown in the previous step.

    0+ In the source schema pane, e)pand OLAPT$AI8: Tables: C(A88:LS. 'hen, drag the sourcecolumns from the chema pane to the Mapping pane for the &5A003 and &A levels as shown in the

    picture %elow.

    'he A7&5A003 level in the hierarchy does not contain a source data column. 8or @AllH'otal@

  • 8/11/2019 Building OLAP Cubes

    27/88

    hierarchy levels, you can enter constants or single row functions. 3nter the following constants for the

    A7&5A003 level #single +uotes are re+uired for te)t literals$4

    Mem%er P >ALL=C(A88:LS?

    6escription attri%utes P >All C!annels?

    'he resulting mapping should loo" li"e this4

    0ote4 'he @AllH'otal@ value ensures that there is a single node at the top of the hierarchy that will %e the

    summary of the data for that dimension.

  • 8/11/2019 Building OLAP Cubes

    28/88

    5+ In the lower right corner of the mapping pane, clic" Apply.

    /esult4 'he &hannel dimension is ready to have data loaded. Although you could load the dimension datanow, you will perform this step later in the tutorial.

    ac" to 'opic ist

  • 8/11/2019 Building OLAP Cubes

    29/88

    ,+ At the &reate 6imensions 8rom 'emplate dialog %o), locate the ...Ltemplates directory, whereyou installed the olaptrain template files.

    8or e)ample4 c:\templates

    'hen, select #:O#$AP(&+MLin the templates directory and clic" Create.

  • 8/11/2019 Building OLAP Cubes

    30/88

    0+ 'he new G3OG/A!59 dimension appears under the 6imensions folder. 6rill on Levels,(ierarc!ies, and Attributesto view its elements.

  • 8/11/2019 Building OLAP Cubes

    31/88

    5+ 'o create the !/O6U&' dimension, right-clic" the Diensionsfolder, then select Create

    Diension ro Teplate, as you did previously in step B.

    4+ At the &reate 6imensions 8rom 'emplate dialog %o), locate the P$OD

  • 8/11/2019 Building OLAP Cubes

    32/88

    7+ 'he new !/O6U&' dimension appears under the 6imensions folder.

  • 8/11/2019 Building OLAP Cubes

    33/88

    9+ 0ow, create the 'IM3 dimension %y right-clic"ing the Diensionsfolder and selecting Create

    Diension ro Teplate+

    ;+ At the &reate 6imensions 8rom 'emplate dialog %o), locate the TIM:+MLfile and clic"

    Create.

    /esult4 'he new 'IM3 dimension appears under the 6imensions folder.

  • 8/11/2019 Building OLAP Cubes

    34/88

    + In the navigator, drill on TIM:: Attributes.

    0otice that there are two special attri%utes -- 30676A'3 and 'IM37!A0 -- have %een created

    for the 'IM3 dimension. ince this dimension was defined as a @'ime@ type, these attri%utes areautomatically created. 'hey must %e mapped to apppropriate source data columns for certain

    OA! time series analysis features to %e ena%led. 9ou will leverage these attri%utes when youcreate time series calculations later in this tutorial.

    *+ 'he Geography, !roduct and 'ime templates all included mappings. 'o view the mappings forthe 'ime dimension, clic" Mappingsunder 'IM3 in the navigator.

  • 8/11/2019 Building OLAP Cubes

    35/88

    As with the other the @AllH'otal@ level in the hierarchy is mapped to either constants or single-row functions.

    9ou can e)amine the mappings for any of these dimensions %y clic"ing on the Mappings ta%under the dimension node in the navigator.

  • 8/11/2019 Building OLAP Cubes

    36/88

  • 8/11/2019 Building OLAP Cubes

    37/88

    ,+ In the General ta% of the &reate &u%e window, specify the following4

    a. 0ame4 SAL:S=C

  • 8/11/2019 Building OLAP Cubes

    38/88

    0otes4 'he order in which the dimensions are listed in a cu%e may affect performance %ecause it

    determines the way the data is stored on dis". In general, when you dimension a cu%e, the firstdimension in a cu%e has the fewest num%er of dimension mem%ers, and the last dimension has

    the largest num%er of dimension mem%ers. 'his is the case in the OA!'/AI0 schema.

    0+ elect the torage ta%. Accept the default option to

  • 8/11/2019 Building OLAP Cubes

    39/88

    0otes4

    What is parsityR When there are a large num%er of empty cells in a cu%e, the cu%e is

    said to %e 1sparse.2 'his is very common in dimensional data models. Most commonly,

    all dimensions are mar"ed as sparse. When one or more dimensions as mar"ed as sparse,OA! creates a special inde) for the cu%e that automatically manages sparsity.

    'he &ompression feature can %e used to significantly reduce the si*e of cu%es and

    improve performance of %oth data loads and +ueries. ince most dimensional data is

  • 8/11/2019 Building OLAP Cubes

    40/88

    sparse, the &ompression option is selected as a default.

    5+ elect the Aggregation ta%. 'hen, in the !recompute su%-ta%, specify a value of 0for &ost-%ased aggregation, as shown here4

    0otes4

    &ost-%ased aggregation ena%les you to select compression for your cu%e. pecify a

    percentage value and the data%ase will precompute and store the most costly aggregate

    values %ased on your input. Using a setting of C< causes a larger percentage of cu%e data to %e aggregated and stored

    than the default setting of ;

  • 8/11/2019 Building OLAP Cubes

    41/88

    ac" to 'opic ist

    Creating Measures

    9ou can create two types of measures in a cu%e4 tored #or ase$ measures, and &alculated measures. 3very measure that %elongs to a

    particular cu%e shares the characteristics that were defined for the cu%e.

    Stored Measures

    ase measures store the facts collected a%out your %usiness. When you create %ase measures in your OA! data model, you will mapthem to source data (ust as you have done with dimensions.

    Calculated Measures

    One of the powerful features of the Oracle OA! technology is the a%ility to efficiently and easily generate %usiness calculations ofdata held in the data%ase. In any OA! implementation, the num%er of calculated measures greatly e)ceeds the num%er of stored

    measures.

    OA! calcuated measures are derived from %ase measures or other calculated measures.'hese calculations are computed dynamically

    as users +uery the data. &alculations are automatically e)posed as columns in a cu%e view > ma"ing it very easy for users to leveragethe rich analytic functionality through very simple .

    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#t
  • 8/11/2019 Building OLAP Cubes

    42/88

    AWM ma"es it very easy to define calculated measures using a graphical &alculation uilder. 'he &alculation uilder contains pre-defined e)amples for many common %usiness calculation types. 9ou select the calculation type you want, and then modify the

    e)ample to create e)actly the calculation that you need.

    In this section, you will create two stored measures and ten calculated measures. 'hree of the calculated measures are created using

    the &alculation uilder, and seven are created using QM template files.

    *+ In the navigator, drill on SAL:S=C

  • 8/11/2019 Building OLAP Cubes

    43/88

    0+ Using the same techni+ues descri%ed in steps B and ;, create a second measure named '

  • 8/11/2019 Building OLAP Cubes

    44/88

    5+ In the navigator, right-clic" on the Calculated Measuresfolder and select Create Calculated Measure.

  • 8/11/2019 Building OLAP Cubes

    45/88

    4+ In the &reate &alculated Measure window, enter or select the following4

    a$ 0ame P SAL:S=&TD#the 0ame field is automatically all caps, and the a%el and 6escription fields are auto-filled$

    %$ &alculation 'ype P Period to Date

    c$ In the &alculation inputs section, select the following4

    8irst hyperlin" P Ancestor At Level

  • 8/11/2019 Building OLAP Cubes

    46/88

    /esult4 A new hyperlin" appears ne)t to Ancestor At evel hyperlin"

    econd hyperlin" P TIM:+CAL:8DA$=&:A$

    /esult4 'he &reate &alculated Measure window should now loo" li"e this4

  • 8/11/2019 Building OLAP Cubes

    47/88

    d$ &lic" Create.

  • 8/11/2019 Building OLAP Cubes

    48/88

    7+ 6rill on the Calculated Measuresnode. /esult4 'he A379'6 calculation appears.

    9+ &reate a 9'6 calculation for the prior year. 'his facilitates year over year comparisons.

    /ight-clic" the Calculated Measuresfolder again, then select Create Calculated Measure+ In the &reate &alculated

    Measure window, enter or select the following4

    a$ 0ame P SAL:S=&TD=P&

    %$ All a%el and 6escription %o)es P Sales &td Pr &ear

    c$ &alculation 'ype P Parallel Period

    d$ In the &alculation inputs section44

    &lic" the SAL:Shyperlin" #this is the second hyperlin"$4

  • 8/11/2019 Building OLAP Cubes

    49/88

    /esult4 'he elect Measure window appears.

    elect SAL:S=&TD#as shown %elow$ and then clic" O6.

  • 8/11/2019 Building OLAP Cubes

    50/88

    /esult4 'he &alculation updates with the selected measure.

    &lic" the 'IM3.&A306A/.A793A/ hyperlin" and select TIM:+CAL:8DA$+ CAL:8DA$=&:A$

    from the list, as shown here4

  • 8/11/2019 Building OLAP Cubes

    51/88

    e$ &lic" Create.

    /esult4 'he A379'67!9 calculation appears %elow the &alculated Measures node in the 0avigator.

    ;+ &reate a third calculation that measures the percent change in 9ear-'o-6ate sales when compared to the previous year./ight-clic" on the Calculated Measuresfolder and select Create Calculated Measure.

    + In the &reate &alculated Measure window, enter or select the following4

    a$ 0ame P SAL:S=&TD=P&=PCT=C(#

    %$ All a%el and 6escription %o)es P Sales &td Pr &r Pct C!g

    c$ &alculation 'ype P Percent Difference ro Parallel Period

    d$ In the &alculation inputs section, clic" the SAL:Shyperlin".

    e$ In the elect Measure window, select SAL:S=&TDand clic" O6.

    f$ &lic" the TIM:+CAL:8DA$+ALL=&:A$S hyperlin" and select TIM:+CAL:8DA$+ CAL:8DA$=&:A$from

    the list.

  • 8/11/2019 Building OLAP Cubes

    52/88

    'he calculation should now loo" li"e this4

    g$ In the 3)pression field, multiply the e+uation %y B

  • 8/11/2019 Building OLAP Cubes

    53/88

    h$ &lic" Create.

    /esult4 'he ales &u%e now contains the following measures4

    *+0e)t, create a calculated measure using an QM template. /ight-clic" on the Calculated Measuresfolder and select

    Create Calculated Measure fro Teplate.

    **+ In the &reate &alculated Measure from 'emplate window4

  • 8/11/2019 Building OLAP Cubes

    54/88

    a. 0avigate to the ...LtemplatesLcalcs directory, where you installed the olaptrain template files.

    8or e)ample4 c:\templates\calcs

    %. 'hen, select SAL:S=P&+ML

    c. &lic" Create.

    /esult4 'he calculation appears in the navigator.

  • 8/11/2019 Building OLAP Cubes

    55/88

    *,+elect the new calculation in the navigator.

    /esult4 'he ales !rior 9ear calculation definition appears in the right-hand pane, as shown %elow4

  • 8/11/2019 Building OLAP Cubes

    56/88

    *0+/epeat steps B< and BB to create eight more calculations using the following QM files4

    A37!97!&'7&5G.QM

    A37!!.QM

    A37!!7!&'7&5G.QM A37 /A0D7!/O67S.QM

    A37 /A0D7!/O67!/0'.QM

    A375A/37!/0'7!/O6.QM

    A375A/37'O'7!/O6.QM

    5OW7I7A379'6.QM

    *5+elect the Calculated Measuresnode in the navigator to display the list of calculated measures in the cu%e.

  • 8/11/2019 Building OLAP Cubes

    57/88

    All of your measures have %een created.

    *4+&lic" the (ow Is Sales &td calculated measure in the navigator to view the definition of the calculation, as shown here4

    0otes4

    'he &alculation 'ype is :Fpression. 'his special calculation type allows the OA! data model developer to

  • 8/11/2019 Building OLAP Cubes

    58/88

    create a custom calculation %y entering the appropriate OA! calculation synta) in the 3)pression %o).

    In this e)ample, the synta) includes a 1&A32 statement that evaluates the series of conditions and returns the

    first e)pression that matches the condition. 'he &A3 statement is designed to return a te)t value descri%ing the

    performance of the current ales 9'6 compared to last year.

    9ou will used this, and other calculated measures later in this tutorial.

    9ou can learn more a%out creating OA! calculations %y attending the Oracle University Oracle Database **g3

    OLAP :ssentialsin&lass course. 8or a description of this course, see More Informationat the end of this tutorial.

    ac" to 'opic ist

    Mapping Cubes to $elational Sources

    After creating an OA! cu%e, you map it to relational data sources in Oracle 6ata%ase. When mapping the cu%e, drag the appropriatesource data column to the associated field for the OA! cu%e element.

    9ou map the following fields4

    'he stored measures that are defined within the cu%e.

    'he lowest level of detail for each dimension hierarchy.

    'he Toin &ondition field. 'his field associates the foreign "ey #f"$ column from the fact ta%le to the primary "ey #p"$ column from

    the dimension ta%le.

    Afterward, you can load data into your analytic wor"space using the Maintain Analytic Wor"space wi*ard.

    *+&lic" the Mappingsnode under A37&U3

    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#mihttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#mihttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#t
  • 8/11/2019 Building OLAP Cubes

    59/88

    3nsure that the 'a%le Mapping Siew is ena%led.

    ,+ In the source schemas pane, drill on OLAPT$AI8: Tables.

  • 8/11/2019 Building OLAP Cubes

    60/88

  • 8/11/2019 Building OLAP Cubes

    61/88

    0+ocate and use the following ta%les4

    A378A&'

    &5A003

    &U'OM3/

    !/O6U&'

    'IM3

    6rag the appropriate columns from each source ta%le to the associated A37&U3 ource &olumn fields, as

    shown in the image %elow.

    0otes4 When mapping the Toin &ondition for each dimension4

    8irst, drag the foreign "ey column from the fact ta%le to the ource &olumn field. 'hen, drag the primary "ey column from the dimension ta%le to the ource &olumn field.

    'he e+ual sign #1P2$ is automatically inserted after you drag the second column into the ource &olumn

    field.

    When the mapping is complete, your source column results should loo" li"e this4

  • 8/11/2019 Building OLAP Cubes

    62/88

  • 8/11/2019 Building OLAP Cubes

    63/88

    5+&lic" Apply.

    ac" to 'opic ist

    :nabling 'uery $ewrite to Cube MGs Hoptional

    In an e)tension of the Materiali*ed Siew capa%ilities for Oracle 6ata%ase, OA! cu%es can %e represented as a cu%e-organi*ed

    materiali*ed views #&u%e MSs$. 'he +uery optimi*er automatically recogni*es when an e)isting &u%e MS can and should %e used to

    satisfy a summary re+uest. A &u%e MS represents a significant summary space, and %enefits include %oth ease of managea%ilityand improved +uery performance.

    If your OA! system re+uirements do not include a need for summary management of e)iting -%ased I applications, then youcan s"ip this optional tas".

    0otes4

    If you chose to ena%le +uery rewrite, supporting cu%e MS o%(ects are automatically created and managed %y the Oracle 6ata%ase.

    efore you can ena%le materiali*ed views for the cu%e, you must first map the cu%e.

    'o ena%le +uery rewrite and MS refresh for your OA! cu%e, peform the following steps.

    *+ In the navigator, clic" SAL:S=C

  • 8/11/2019 Building OLAP Cubes

    64/88

    ,+ In the right pane, clic" the Materiali*ed Siews ta% and select the following options4

    :nable MaterialiJed Giew $efres! of t!e Cube

    :nable 'uery $ewrite

  • 8/11/2019 Building OLAP Cubes

    65/88

    0otes4

  • 8/11/2019 Building OLAP Cubes

    66/88

    0+Accept the default settings for all other options, and then clic" Apply.

    /esult4 the following information %o) appears4

    When the information %o) closes, cu%e MSs are ena%led and ready for use %y the Materiali*ed Siew su%system.

    0ote4 8or more information on ena%ling and trou%leshooting uery /ewrite to &u%e MSs, see this white paper.

    ac" to 'opic ist

    Loading and Giewing Cube Data

    'he Maintenance Wi*ard loads and aggregates the data in a single step. 9ou can load all mapped o%(ects in the analytic wor"space, or

    individual dimensions and measures. 9ou can also choose to run the (o% immediately, enter it in the Oracle To% ueue, or save it as a script.

    y default, when you load data to a cu%e, the dimensions of that cu%e are also processed. If you have already loaded dimension data,you can specify only to load measure data.

    In the following steps, you load all data for the cu%e and run the (o% immediately. 'hen you view the data in AWM.

    *+ In the navigator, right-clic" on SAL:S=C

  • 8/11/2019 Building OLAP Cubes

    67/88

    ,+ In the Maintenance Wi*ard, clic" inis!to %egin the load process.

  • 8/11/2019 Building OLAP Cubes

    68/88

  • 8/11/2019 Building OLAP Cubes

    69/88

    0+ When the %uild completes, the uild og window appears.

  • 8/11/2019 Building OLAP Cubes

    70/88

    If you scroll to the right, and then down in the uild og, you can see how each of the cu%e partitions were

  • 8/11/2019 Building OLAP Cubes

    71/88

    processed. &lic" Closeafter you finish e)amining the uild og.

    0ote4 'here are several logs that you can view from the navigator %y clic"ing on the $eportsnode.

    4+ 9ou can view OA! data from within AWM.

    In the 0avigator, right-clic" on the SAL:Smeasure and selectGiew Data Salesfrom the menu.

  • 8/11/2019 Building OLAP Cubes

    72/88

    /esult4 ales data is displayed for a default set of dimension mem%ers in a crossta% and a graph.

    7+ In the 6ata Siewer, drill on All &ears. 'he following data appears in the crossta%4

  • 8/11/2019 Building OLAP Cubes

    73/88

    0ote4 &9;

  • 8/11/2019 Building OLAP Cubes

    74/88

    %$ &lic" the Add Selected Itestool #:$ to move those two measures to the elected list, li"e this4

    + &lic" the Layoutta%. In the ayout ta%, drag the appropriate dimension tiles to the correct a)is so that the

    layout loo"s li"e this4

  • 8/11/2019 Building OLAP Cubes

    75/88

    *+&lic" the Diensionsta%. In the 6imensions ta%, perform the following4

    a$ elect the Tiedimension from the &hoose drop-down list.

    %$ &lic" the $eove All Itestool #$ to clear the elected list.

    c$ In the Mem%ers ta% of the Availa%le list, drill on All &ears: C&,.

    d$ elect all four +uarters in &9;

  • 8/11/2019 Building OLAP Cubes

    76/88

    f$ elect Productfrom the &hoose drop-down list.

    g$ &lic" the $eove All Itestool and then drill on All Productsin the Availa%le list. 8inally, select the

    three !roduct department mem%ers, li"e this4

    h$ &lic" the Add Itestool to move the department mem%ers to the elected list.

  • 8/11/2019 Building OLAP Cubes

    77/88

    i$ &lic" O6to view the data.

    **+ elect any of the mem%ers from the !roduct dimension header. 'he calculations are instantaneously updated.

    6rill on any of the ;

  • 8/11/2019 Building OLAP Cubes

    78/88

    *0+'hen, clic" the 'uery Buildertool, and in the Items ta%, perform the following4

    a$ In the elected list, select Sales Pr &earand Sales Pr &ear Pct C!g.

    %$ &lic" the $eove Selected Itestool #$.

    c$ In the Availa%le list, select Sales &td, Sales &td Pr &ear Pct C!g, and (ow Is Sales &td.

    d$,&lic" the Add Selected Itestool #:$.

    /esult4 'he 9ear to 6ate measures are added to the elected list.

  • 8/11/2019 Building OLAP Cubes

    79/88

    *5+In the ayout ta%, swap the !roduct and 'ime dimensions, so that !roduct is in the /ow a)is, and 'ime is in

    the !age Items a)is, li"e this4

  • 8/11/2019 Building OLAP Cubes

    80/88

    *4+&lic" O6to view the data.

    'he calculated measures show4

    'he ales 9ear-'o-6ate data #in this case, the same as ales, since B-&9;

  • 8/11/2019 Building OLAP Cubes

    81/88

    /esult4 'he stored and calculated data updates with the correct values.

    *9+8rom the 'ime dimension header, select '5%C&,.

    'he 5ow Is ales 9td measure correctly reflects the newly +ueried data.

  • 8/11/2019 Building OLAP Cubes

    82/88

    *;+6rill on Coputers.

    Again, the 9'6 performance measures automatically update to reflect the current selections.

    *+8inally, you modify the 6ata Siewer for a product ran"ing and share report.

    - 8irst, collapse the !roduct dimension drills to display only the three product departments.

    - econd, select '*%C&,from the 'ime dimension header.

    'hen, clic" the 'uery Buildertool.

    ,+In the Items ta%, perform the following4

  • 8/11/2019 Building OLAP Cubes

    83/88

    a$ In the elected list, selectSales &td, Sales &td Pr &ear Pct C!g, and (ow Is Sales &td.

    %$ &lic" the $eove Selected Itestool #$.

    c$ In the Availa%le list, select Sales $an/ In Prod Prntand Sales S!are Prnt Prod.

    d$,&lic" the Add Selected Itestool #:$.

    /esult4 'he ran" and share measures are added to the elected list.

    ,*+&lic" O6to view the data.

    'he calculated measures show4

    'he ran" of each !roduct dimension mem%er within its hierarchy parent.

    'he share of each product mem%er as a percentage of sales returned %y that product mem%er to its

    parent in the hierarchy.

  • 8/11/2019 Building OLAP Cubes

    84/88

    ,,+6rill on Coputers.

    'he ran" and share measures show the relative ran"ing and share contri%ution for each of the !roduct

    division mem%ers in the &omputer department.

    ,0+elect any 'ime mem%er from the !age Items a)is, and the calculations update instantaneously.

    8eel free to modify the report %y drilling or selected other dimension mem%ers.

    When you are done, close the Measure 6ata Siewer.

    ,5+9ou can also perform ad-hoc, multidimensional analysis against OA! data with any -%ased tool. Oracle

    OA! data is made directly accessi%le to %y a set of relational views that are automatically created andmaintained %y Oracle OA!. 9ou +uery OA! data %y e)ecuting simple statements against these

    associated &u%e Siews.

  • 8/11/2019 Building OLAP Cubes

    85/88

    &lic" SAL:S=C

  • 8/11/2019 Building OLAP Cubes

    86/88

  • 8/11/2019 Building OLAP Cubes

    87/88

    ,7+'he +uery a%ove is e)ecuted, and the resulting output shows the same data that was returned in step ;B.

    8or information how to +uery OA! data using , see the uerying OA! &u%esO3 lesson.

    ac" to 'opic ist

    More Inforation

    8or more information on OA!-related education, use the following lin"s4

    Oracle 6ata%ase BBg4 OA! 3ssentials#Oracle

    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/QueryCubes.htmhttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://education.oracle.com/pls/web_prod-plq-dad/show_desc.redirect?dc=D70039GC10&p_org_id=1001&lang=US&source_call=http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/QueryCubes.htmhttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://education.oracle.com/pls/web_prod-plq-dad/show_desc.redirect?dc=D70039GC10&p_org_id=1001&lang=US&source_call=
  • 8/11/2019 Building OLAP Cubes

    88/88

    University in&lass$

    Oracle OA!#O'0 site$

    ac" to 'opic ist

    Place t!e cursor over t!is icon to !ide all screens!ots+

    http://www.oracle.com/technetwork/database/options/olap/index.htmlhttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#thttp://www.oracle.com/technetwork/database/options/olap/index.htmlhttp://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/olap/olap_cube/buildicubes.htm#t