Building OLAP Cubes

Published on January 2017 | Categories: Documents | Downloads: 39 | Comments: 0 | Views: 165
of 88
Download PDF   Embed   Report

Comments

Content


Building OLAP Cubes
Topics
Overview
AWM is a tool for creating, developing, and managing multidimensional data in an Oracle data warehouse. With this easy-to-use GUI
tool, 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, including
dimensionality, 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%(ect
that 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, and
normali*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 transactional
system 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.
,A3,78A&' ,tores purchases in dollars, +uantity, and price, %y channel of distri%ution,
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, the
re+uired stored and calculated measures are identified as part of the %usiness re+uirements definition process. 'he resulting logical
model %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! data
model4
• &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 not
necessarily 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, the
following the levels of summari*ation within each dimension have %een identified as part of the OA! data model4
C!annel diension has 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" and C!annel.
#eograp!y diension reflects 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, the
levels 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 diension will have si) levels. 'hese levels reflect the same levels of detail in the source data. 8rom highest to lowest, the
OA! levels are4 All Products" Departent" Category" Type" Subtype" and Ite.
Tie diension will have four levels #highest to lowest$4 All &ears" Calendar &ear" Calendar 'uarter" and Mont!. 6ata is
availa%le for the years ;<<=>;<<?.
Within each dimension, notice that an @All@ #'otal$ level is added as the highest level of summari*ation. Adding this highest level
provides additional fle)i%ility as application users analy*e OA! data.
Identifying (ierarc!ies
5ierarchies organi*e the levels within each dimension. 'o identify hierarchies, you group the levels in the correct order of
summari*ation and in a way that supports the identified types of analysis. 9ou can orgaini*e levels into any num%er of hierarchies for
each dimension.
In this OA! data model, only one hierarchy is re+uired for each dimension. 'he hierachy levels are designed as shown in the ta%le
a%ove.
Identifying Measures
Analysis re+uirements include %oth stored and calculated measures. 'wo of the measures are ac+uired from the fact ta%le, and the
remaining measures are created and managed as OA! calculations4
,tored Measures ,ales
-uantity
&alculated Measures ,ales 9ear-to-6ate
,ales 9ear-to-6ate !rior 9ear
,ales 9ear-to-6ate !rior 9ear A &hange
,ales !rior 9ear A &hange
,ales !rior !eriod
,ales !rior !eriod A &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 into
any 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
;. 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! BBg ,ample ,chema
,ample ,chema Installation Instructions
'his document e)plains how to install the sample schema that is used for Oracle OA! BBg
collateral4 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
6.A 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 ; if
you 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.<.? or higher$ with Oracle OA! Option ena%led
Installation Instructions
' he installation routine#s$ performs the following tas"s4
B. &reates two ta%lespaces4 dm and dm7archive
;. &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 already
e)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 Finstall7homeG
;. 6ownload and un*ip olaptrain7install.*ip into this directory
C. &hange to the Finstall7homeGHolaptrain7install directory
E. og in to ,-I!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 ,-I!lus prompt, run Kinstall7olaptrain. 8ollow the directions at the ,-I!lus
prompts
8or e)ample4
: cd Finstall7homeGHolaptrain7install
: 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 6.A to e)ecute this procedure.
;. 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)ample4
c4LdownloadLolaptrain7install or HhomeHoracleHolaptrain7install
6irectory4 Finstall7homeGHolaptrain7install
,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 the
OA!'/AI0 schema #it will %e recreated$.
;. &hange to the Finstall7homeGHolaptrain7install directory
C. og in to ,-I!lus as a d%a user
E. At the ,-I!lus prompt, run Kcreate7olaptrain7cu%es. 8ollow the directions at the
,-I!lus prompts
'he cu%es and dimensions are now availa%le for +uery.
8or e)ample4
: cd Finstall7homeGHolaptrain7install
: s+lplus H as sysd%a
,-: Kcreate7olaptrain7cu%es
,pecify file system directory containing this installation program.
3)ample4
c4LdownloadLolaptrain7install or HhomeHoracleHolaptrain7install
6irectory4 Finstall7homeGHolaptrain7install
,pecify a password for the OA!'/AI0 user.
!assword4 password

E. a. 6ownload olaptrain7templates.*ip to a location on the machine where AWM is installed.
%. Un*ip the files.
'he resulting directory structure is4 <your_path>\templates\calcs
'he files in the +++-teplates directory, and the +++-teplates-calcs directory 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.;.<.E.<..(ar file, or from your des"top
shortcut.
,+ /ight-clic" Databases and select Add Database to tree.

0+ 3nter Oracle in the 6escription field and 1!ostnae23*4,*31SID2 in the &onnection
Information field and clic" Create.

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

4+ 3nter olaptrain as the Username and oracle as the !assword. 'hen clic" O6.

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

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

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

.ac" to 'opic ist
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 within
the 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 Diensions folder and select Create Diension.

,+ At the default General ta% in the &reate 6imension dialog %o), enter C(A88:L as the name
and select <ser Diension as dimension type.

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

5+ In the Implementation 6etails ta%, select <se 6eys fro Data Source.
'hen, clic" Create.

4+ 9our dimension, and its associated levels, have %een created.

.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 a
transactional 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 aggregationO for
e)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. A
hierarchy 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!ies folder, then select Create (ierarc!y+

,+ In the &reate 5ierarchy window, enter SAL:S=C(A88:L as the name. &lic" the Add All #::$
tool to select all the levels and clic" Create.

0+ 'he new ,A3,7&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 Attributes folder, then select Create Attribute.

,+ In the &reate Attri%ute dialog, select or enter the following4
a. 0ame P C(A88:L=T&P:
%. Attri%ute 'ype P <ser
c. In the 1Apply Attri%utes to2 %o)4
• 6rill on the &hannel dimension.
• 6eselect the &hannel dimension chec" %o).
• ,elect only the C(A88:L level chec" %o) #the lowest level$.
0ote4 'he &hannel 'ype attri%ute only applies to the lowest level in the ,ales &hannel hierarchy.
'he &reate Attri%ute dialog %o) should loo" li"e this4
&lic" Create.

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

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

.ac" to 'opic ist
Mapping Diensions to $elational Sources
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:L dimension 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

,+ 3nsure that Star Sc!ea is 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 source
columns 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@
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.

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 data
now, you will perform this step later in the tutorial.

.ac" to 'opic ist
<sing Teplates to Define Data Ob@ects
'he template feature in Analytic Wor"space Manager saves the definition of the OA! data o%(ects as an QM file. Using a saved
template, you can create a new analytic wor"space, dimension, cu%e, and measure e)actly li"e an e)isting o%(ect, with or without
mappings. 'emplates do not include the data, only the definition of the o%(ect.
'emplates allow you to4
,hare analytic wor"space designs with other users.
'ransfer o%(ect definitions to other schema or instances.
!ersist o%(ect definitions outside data%ase.
!lace o%(ect definitions in source control.
In this section, you create three dimensions, G3OG/A!59, !/O6U&' and 'IM3 from previously saved templates. !erform the
following steps4
*+ /ight-clic" the Diensions folder, then select Create Diension Aro Teplate+

,+ At the &reate 6imensions 8rom 'emplate dialog %o), locate the ...Ltemplates directory, where
you installed the olaptrain template files.
8or e)ample4 c:<your_path>\templates
'hen, select #:O#$AP(&+BML in the templates directory and clic" Create.

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

5+ 'o create the !/O6U&' dimension, right-clic" the Diensions folder, then select Create
Diension Aro Teplate, as you did previously in step B.
4+ At the &reate 6imensions 8rom 'emplate dialog %o), locate the P$OD<CT+BML file and clic"
Create.

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

9+ 0ow, create the 'IM3 dimension %y right-clic"ing the Diensions folder and selecting Create
Diension Aro Teplate+
;+ At the &reate 6imensions 8rom 'emplate dialog %o), locate the TIM:+BML file and clic"
Create.
/esult4 'he new 'IM3 dimension appears under the 6imensions folder.

C+ 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 are
automatically 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 you
create time series calculations later in this tutorial.

*D+ 'he Geography, !roduct and 'ime templates all included mappings. 'o view the mappings for
the 'ime dimension, clic" Mappings under 'IM3 in the navigator.
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.

.ac" to 'opic ist
Defining Cubes
In Oracle OA!, a &u%e provides a convenient way of collecting measures of the same dimensionality. 'herefore, a cu%e is simply an
o%(ect that helps an administrator to %uild and maintain an AW.
&u%es aid in the definition of measures with common characteristics, including the following4
'he edges of a &u%e are defined %y its dimensions. If multiple measures have the same dimensionality, it is li"ely that they will %e
defined in the same cu%e..
Measures that share sparsity patterns and aggregation rules are commonly defined in the same &u%e.
Measures in the same &u%e have the same relationships to other logical o%(ects and can easily %e analy*ed and displayed together.
A particular AW may contain more than one &u%e, and each cu%e may descri%e a different dimensional shape.
Multiple &u%es in the same AW may share one or more dimensions.
8or e)ample, sales data can %e organi*ed into a cu%e, whose edges contain values from the channel, geography, product, and time
dimensions and whose %ody contains measures that might include dollar sales, unit sales, and a range calculated measures %ased on
sales and +uantity sold.
!erform the following steps to create a cu%e that will %e used to organi*e a variety of sales measures4
*+ /ight clic" the Cubes folder, then clic" Create Cube+

,+ In the General ta% of the &reate &u%e window, specify the following4
a. 0ame4 SAL:S=C<B:
%. Use the Add tool #:$ to selected dimensions in the following order4
• C(A88:L
• TIM:
• #:O#$AP(&
• P$OD<CT
/esult4 the &reate &u%e window should loo" li"e this4
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 first
dimension 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 <se copression, and then ena%le the ,parse
option for all dimensions, as shown here
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
sparse, the &ompression option is selected as a default.

5+ ,elect the Aggregation ta%. 'hen, in the !recompute su%-ta%, specify a value of 0D for &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 ;<.

4+ At the %ottom of the &reate &u%e dialog %o), clic" Create.
/esult4 the ,A3,7&U.3 node appears in the navigator under &u%es.
.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 map
them 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 of
data 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 leverage
the rich analytic functionality through very simple ,-.
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<B:. 'hen, right-clic" on the Measures folder and select Create Measure.

,+ At the &reate Measure dialog %o), enter SAL:S as the name and clic" Create.

0+ Using the same techni+ues descri%ed in steps B and ;, create a second measure named '<A8TIT&.
In the navigator, drill on Measures. 9ou should see the following4

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

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
/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
d$ &lic" Create.

7+ 6rill on the Calculated Measures node. /esult4 'he ,A3,79'6 calculation appears.

9+ &reate a 9'6 calculation for the prior year. 'his facilitates year over year comparisons.
/ight-clic" the Calculated Measures folder 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:S hyperlin" #this is the second hyperlin"$4
/esult4 'he ,elect Measure window appears.
• ,elect SAL:S=&TD #as shown %elow$ and then clic" O6.
/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
e$ &lic" Create.
/esult4 'he ,A3,79'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 Measures folder and select Create Calculated Measure.
C+ 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 Aro Parallel Period
d$ In the &alculation inputs section, clic" the SAL:S hyperlin".
e$ In the ,elect Measure window, select SAL:S=&TD and clic" O6.
f$ &lic" the TIM:+CAL:8DA$+ALL=&:A$S hyperlin" and select TIM:+CAL:8DA$+ CAL:8DA$=&:A$ from
the list.
'he calculation should now loo" li"e this4
g$ In the 3)pression field, multiply the e+uation %y B<< %y adding the following synta) to the %eginning of the
e)pression4 *DD E
'he e)pression should now loo" li"e this4
0ote4 'his additional synta) will cause the calculation to display percentage figures in whole num%ers.
h$ &lic" Create.
/esult4 'he ,ales &u%e now contains the following measures4

*D+ 0e)t, create a calculated measure using an QM template. /ight-clic" on the Calculated Measures folder and select
Create Calculated Measure fro Teplate.

**+ In the &reate &alculated Measure from 'emplate window4
a. 0avigate to the ...LtemplatesLcalcs directory, where you installed the olaptrain template files.
8or e)ample4 c:<your_path>\templates\calcs
%. 'hen, select SAL:S=P&+BML
c. &lic" Create.
/esult4 'he calculation appears in the navigator.
*,+ ,elect the new calculation in the navigator.
/esult4 'he ,ales !rior 9ear calculation definition appears in the right-hand pane, as shown %elow4
*0+ /epeat steps B< and BB to create eight more calculations using the following QM files4
• ,A3,7!97!&'7&5G.QM
• ,A3,7!!.QM
• ,A3,7!!7!&'7&5G.QM
• ,A3,7 /A0D7!/O67S.QM
• ,A3,7 /A0D7!/O67!/0'.QM
• ,A3,7,5A/37!/0'7!/O6.QM
• ,A3,7,5A/37'O'7!/O6.QM
• 5OW7I,7,A3,79'6.QM

*5+ ,elect the Calculated Measures node in the navigator to display the list of calculated measures in the cu%e.
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
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&A,32 statement that evaluates the series of conditions and returns the
first e)pression that matches the condition. 'he &A,3 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 :ssentials in&lass course. 8or a description of this course, see More Information at 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 appropriate
source 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 Mappings node under ,A3,7&U.3
3nsure that the 'a%le Mapping Siew is ena%led.

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

0+ ocate and use the following ta%les4
• ,A3,78A&'
• &5A003,
• &U,'OM3/,
• !/O6U&',
• 'IM3,
6rag the appropriate columns from each source ta%le to the associated ,A3,7&U.3 ,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

5+ &lic" Apply.

.ac" to 'opic ist
:nabling 'uery $ewrite to Cube MGs HoptionalI
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%ility
and improved +uery performance.
If your OA! system re+uirements do not include a need for summary management of e)iting ,--%ased .I applications, then you
can 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<B:.

,+ 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
0otes4
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<B: and then select Maintain Cube SAL:S=C<B:.

,+ In the Maintenance Wi*ard, clic" Ainis! to %egin the load process.
0ote4 'he default settings for an immediate %uild of all cu%e o%(ects is applied.
/esult4 'he following information %o) appears4

0+ When the %uild completes, the .uild og window appears.
If you scroll to the right, and then down in the .uild og, you can see how each of the cu%e partitions were
processed. &lic" Close after you finish e)amining the .uild og.
0ote4 'here are several logs that you can view from the navigator %y clic"ing on the $eports node.

4+ 9ou can view OA! data from within AWM.
In the 0avigator, right-clic" on the SAL:S measure and select Giew Data Sales from the menu.
/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
0ote4 &9;<B< is %lan" %ecause data for the ;<B< calendar year is not stored in the relational schema.
&9;<B< time periods are %uilt into the OA! data model so that new data can %e automatically updated with
su%e+uent data loads.

9+ &lic" the -uery .uilder tool , under the 8ile menu.

;+ In the Items ta%, perform the following4
a$ ,elect Sales Pr &ear and Sales Pr &ear Pct C!g.
%$ &lic" the Add Selected Ites tool #:$ to move those two measures to the ,elected list, li"e this4

C+ &lic" the Layout ta%. In the ayout ta%, drag the appropriate dimension tiles to the correct a)is so that the
layout loo"s li"e this4

*D+ &lic" the Diensions ta%. In the 6imensions ta%, perform the following4
a$ ,elect the Tie dimension from the &hoose drop-down list.
%$ &lic" the $eove All Ites tool #UU$ to clear the ,elected list.
c$ In the Mem%ers ta% of the Availa%le list, drill on All &ears : C&,DDC.
d$ ,elect all four +uarters in &9;<<V, li"e this4
e$ &lic" the Add Ites tool #:$ to move the ;<<V +uarters to the ,elected list, li"e this4
f$ ,elect Product from the &hoose drop-down list.
g$ &lic" the $eove All Ites tool and then drill on All Products in the Availa%le list. 8inally, select the
three !roduct department mem%ers, li"e this4
h$ &lic" the Add Ites tool to move the department mem%ers to the ,elected list.
i$ &lic" O6 to view the data.

**+ ,elect any of the mem%ers from the !roduct dimension header. 'he calculations are instantaneously updated.
6rill on any of the ;<<V -uarter values to view the data at the month level.
When you are done e)perimenting with the report, collapse all drills on the 'ime dimension, so that only the
four +uarters of ;<<V are displayed.

*,+ 0e)t, you modify the 6ata Siewer for a 9ear-to-6ate analysis report.
8irst, hide the Graph %y clic"ing on the down arrow of the 5ideH,how tool.

*0+ 'hen, clic" the 'uery Builder tool, and in the Items ta%, perform the following4
a$ In the ,elected list, select Sales Pr &ear and Sales Pr &ear Pct C!g.
%$ &lic" the $eove Selected Ites tool #U$.
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 Ites tool #:$.
/esult4 'he 9ear to 6ate measures are added to the ,elected list.

*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

*4+ &lic" O6 to view the data.
'he calculated measures show4
• 'he ,ales 9ear-'o-6ate data #in this case, the same as ,ales, since -B-&9;<<V is selected$.
• 'he percent change when comparing ,ales 9'6 for the current period #-B-;<<V$ to ,ales 9'6 for
the prior year #-B-;<<W$.
• 'e)t values that descri%e ,ales 9'6 percent change performance as @0eeds Improvement@, @On
'rac"@, or @Outstanding@. /ecall that a conditional &A,3 statement is used in this calculated measure
to produce the result.

*7+ 8rom the 'ime dimension header, select ',%C&,DDC, as shown here4
/esult4 'he stored and calculated data updates with the correct values.

*9+ 8rom the 'ime dimension header, select '5%C&,DDC.
'he 5ow Is ,ales 9td measure correctly reflects the newly +ueried data.

*;+ 6rill on Coputers.
Again, the 9'6 performance measures automatically update to reflect the current selections.

*C+ 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&,DDC from the 'ime dimension header.
'hen, clic" the 'uery Builder tool.

,D+ In the Items ta%, perform the following4
a$ In the ,elected list, select Sales &td, Sales &td Pr &ear Pct C!g , and (ow Is Sales &td.
%$ &lic" the $eove Selected Ites tool #U$.
c$ In the Availa%le list, select Sales $an/ In Prod Prnt and Sales S!are Prnt Prod.
d$,&lic" the Add Selected Ites tool #:$.
/esult4 'he ran" and share measures are added to the ,elected list.
,*+ &lic" O6 to 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.

,,+ 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 and
maintained %y Oracle OA!. 9ou +uery OA! data %y e)ecuting simple ,- statements against these
associated &u%e Siews.
&lic" SAL:S=C<B:=GI:. -- the view created for ,A3,7&U.3 -- to display information and data for
the view.
Oracle OA! creates and maintains views for each cu%e and dimension. 'hese views represent an OA!
&u%e as a star schema with the following characteristics4
• A cu%e view plays the role of a fact ta%le.
• 6imension views and hierarchy views play the role of dimension ta%les #a dimension and a hierarchy
view are created and maintained for each dimension in the OA! data model$.
Although ,- access to OA! cu%es is covered in another tutorial, an e)ample of a ,- +uery against the
cu%e that you (ust created is provided ne)t.

,4+ In the e)ample shown here, ,- 6eveloper is used to write a ,- +uery.
'he ,- statement, e)plained %y in-line notes, +ueries the same data that is selected %y AWM in step ;B.
0ote4 ,- 6eveloper is shipped free with Oracle 6ata%ase.

,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%es O.3 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
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+




Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close