Tuesday, November 29, 2011

OBIEE 11g Repository Beginner’s Guide




Building Business Model and Mapping  Layer


In the business model and mapping layer you can simplify the physical metadata to make it understandable to the end user in an easier way. Creating business (Logical) model you can represent the logical structure of the information in the repository to meet the business requirement to analyze the data. (All the tables get denormalized in BMM layer)

The business models contain logical columns arranged in logical tables, logical joins and dimensional hierarchy definitions. This layer also contains the mappings from the logical columns to the source data in the Physical layer means specifies the mapping between the business models and the Physical layer schemas.

Building business model you can define what users think about their business using their own business terms. There are two main categories of logical tables Fact and Dimension. Logical fact tables contain all the measures related to business operations and performance. Logical dimension tables contain the data used to qualify the facts to meet the business requirement and result with some meaningful information in terms of data.


Business Modeling and Mapping Layer Objects



1. Creating Logical Schema/ Business Model.

Right click in the blank middle pane of the Oracle BI Administration Tool and select the New Business Model option. Specify a name sample sales for the business model.
This schema is not ready for query, so it’s appeared with a red mark over on the schema icon.


2. Creating Logical Tables.

Now create new logical dimension and fact table.

Right click on the logical schema -> select New Object -> Logical Table.


Create empty logical tables manually as per below list, without any source and column.



3. Creating Logical Table Sources.

Create logical table sources for all the logical tables,
3.1 Select a table (Here D0 Time table is selected) -> Right click, elect New Object -> Logical Table Source.


3.2 Now give a name for logical table source -> click on the green + plus sign.


3.3 In the next window select and expand the physical schema -> Select a physical table -> click on Select button to make it logical table sources (here samplesales1 schema is expanded and A07 Time Day is selected).             


3.4 Check the new logical table source is mapped with physical table source.


3.5 Check and verify into Business model and mapping layer the new logical table source under the logical table. 

3.6 Now use above steps to create more required logical table sources, First  create sources for dimension tables using below matrix, having Logical table name, logical table source name and physical table source to map. (Here logical table source B08 Time Mth is mapped with physical schema2 samplesales2 B08 Time Mth and D0 Time, D1 Customer, D6 Dim Degenerated Facts having multiple logical table sources). 


Create Logical table sources for Fact Tables.

3.7 Now create logical table sources for fact tables (Here F3 Rolling Measures logical table has three logical table sources and each logical table source is mapped with multiple physical table sources).

Follow the steps from 3.1 to 3.5 to create logical table sources and map the logical table source from multiple physical table sources using add table source.

When any logical table source is mapped with two physical table sources then joins were automatically detected with its type.      
                                                                       

3.8 Use below matrix and create logical table sources for all mentioned fact tables and map from physical table sources.

3.9 Below listed tables don’t have any logical table source and mapping with any physical table source, these are derived tables from the existing logical tables.


4. Creating Logical columns for Dimension Tables

There are two ways to create logical columns

A) Drag and Drop: - Select a physical column -> Click on it, drag from physical layer and drop into BMM layer in particular logical table, in which you want to add a new column. (It will automatically create the logical table source and mapping with physical column).

B) Manually: -

4.1) Right click on table -> select New Object -> Logical Column -> click on General tab enter name for the new logical column.


4.2) Now click on the Logical Table Source -> Select Column Mapping Tab (select Show unmapped Columns -> Check the newly created logical column will appear).


4.3) Click below Physical Table first to select the physical table for this current logical table source then click below of Expression to select the column from physical table.


4.4) Go back to column properties -> Column Source, Check column source type -> Derived from Physical sources, you can see the mapping information to verify the mapping.


4.5) Similarly create other logical columns and also can map one logical column form two logical table sources using step 4.3. Create new logical columns as per below given list.



Map all the columns as per given mapping information, here some columns were mapped from multiple logical table sources. Columns mapped from logical table sources A07 Time Day.


Columns mapped from logical table sources A08 Time Mth.


Columns mapped from logical table sources B08 Time Mth.


4.6) Create logical columns for logical table D1 Customer and map columns as per below given list.


Columns mapped from logical table sources A01 Customer.


Columns mapped from logical table sources A09 Segment.

4.7) Create logical columns for logical table D2 Market and map columns as per below given list.


Columns mapped from logical table sources A02 Market.



4.8) Create logical columns for logical table D3 Order and map columns as per below given list.


Columns mapped from logical table sources A02 Market.


4.9) Create logical columns for logical table D4 Product and map columns as per below given list.

Columns mapped from logical table sources A05 Product.


4.10) Create logical columns for logical table D5 Employee and map columns as per below given list.


Columns mapped from logical table sources A06 Employee.


4.11) Create logical columns for logical table D6 Dim Degenerated Facts and map columns as per below given list.


Columns mapped from logical table sources 11 Revenue (Billed Time Join).


Columns mapped from logical table sources 12 Revenue (Booked Time Join).


5. Creating Dimension Hierarchies

A Dimension Hierarchy allowing Oracle BI Server to calculate useful measures, allowing users to drill down for more details. For every dimension hierarchy you need to organize all dimension attributes in hierarchical levels which represent the organizational rules and reporting needs required by your business. These hierarchy levels provide the structure that Oracle BI Server uses to drill into and across dimensions to get more detailed views of the data. Levels of dimension hierarchy are used to perform aggregate navigation, configure level-based measure, calculations and determine what attributes appear when Oracle BI users drill down in their data requests.

Each level has at least one logical key, the top level is marked as the “grand total” level, and you can drag other attributes in to each level and have OBI EE display those, rather than the level key, when users drill down in reports. At present, you have to create these dimensions manually when setting up your business model and mapping layer, although there is talk about automatically creating these when importing Oracle dimensions or OLAP structures.

First of all Update All Rows Counts -> check how many rows in every table and last updated state. This will help you to define level number of members at this level for each level of all the hierarchies.


5.1 Now first step is to create a logical dimension hierarchy, create a logical dimension object. There are two methods to create logical dimension objects.

Method1:- Right Click on the Business model in BMM layer select New Object -> Logical Dimension -> Dimension with Level Based Hierarchy.(Here structure is selected as Time because it’s a time dimension for  other dimension hierarchies don’t select Time as structure )     


Method2:- Right Click on a logical dimension table and select Create Dimension -> Dimension with Level-Based Hierarchy, this will create a dimension hierarchy for the selected dimension table.


Let`s continue with Method1 to create dimension hierarchies.

5.2 Start to add a logical level which is highest level of hierarchy. Right click on the logical dimension and select New Object -> Logical level.


5.3 Give a name to this level -> select Grand Total Level, basically the first level should be grand total level. (Selecting the Grand total level check box is to indicate that this is the grand total level of this hierarchy).



5.4 Now add a child level to dimension hierarchy.

 Right-click on the Parent level (Total) and select New Object -> Child Level.



Give a name for the level and enter the Number of levels at this level.

Now you need to identify the number of elements for each level. The number of elements represents the distinct count of rows for each level and is used by Oracle BI Server to determine the most efficient way to access data when picking aggregate sources. The number does not have to be exact, but ratios of numbers from one level to another should be accurate and you want to enter a larger number for child levels in respect to parent levels.

Enter number of elements at this level from updated all row counts and ener value that how many rows year column contains.


5.5 Similarly add more child levels below this level as shown in below screen shot.



5.6 Create Level Keys: - Level keys define the unique elements in each level and provide the context for drill down. Each level needs to have one or more attributes that compose a level key. The level key defines the unique elements in each level and provides the context for drill down.

A level may have more than one level key. When that is the case, you need to specify which key is the primary key of that level. All dimension sources that have aggregate content at a specified level need to contain the column that is the primary key of that level.

To create Level keys drag a logical column which could be the key for that level. 



5.7 Double-click a level to open the level properties window -> Click the Keys tab and enter key name -> click on the primary keys dropdown select the key name to enable the edit and delete button .

Then click on edit button  to open the logical key dialog box for this level. Select a column form columns to create a key column for this level and select use for display -> click ok.


5.8 Check out the changes and assigned key at the level -> click ok. The color of level key icon will change.


5.9 Similarly assign keys for each level using steps 4.6 to 4.8.


5.10 Now just follow the above steps from 4.1 to 4.8 and create other dimension hierarchies, levels and level keys as per the below given screen shots.

H1 Customer Hierarchy


H2 Market Dimension Hierarchy

H3 Order Dimension Hierarchy


H4 Product


H5 Employee


H6 Dim Fact Attributes Dimension Hierarchy


(Right click on the level key A-00 Order Key click on set icon select ghost icon to set.)

After creating all hierarchies add measures level from facts as shown in tab 7 7.Hierarchies & Levels from details_samplesales sheet.



6. Creating Repository Variables

Click on Manage option into Oracle BI Administration Tool-> select Variables, The variable manager window will open.

Expand the Repository section ->Click on Static -> right click into right pan-> click on New Repository Variable, a Static Repository Variable window will open.

Enter name for the variable-> Select Type and Enter Default Initializer value.



Using above steps create two more static variables as shown below.


7. Creating Measures (Logical Columns) into Fact tables.

7.1) Creating a measure/ logical column without mapping with any source and column.

7.1.1) Right click on table -> select New Object -> Logical Column -> click on General tab enter name for the new measure or logical column.


7.1.2) Click on Column Source-> Select Derived from existing column using an expression -> enter an expression-> click ok. 


7.1.3) Right click on Set an Icon to recognize this column, choose paper icon and click ok.


7.2) Creating a measure/ logical column Derived from physical columns mappings and applying Default Aggregation Rule. (It’s similar to creating and mapping a new logical column from physical source and column).

7.2.1) Create a column and then select column source tab-> select derived from physical source mappings. (Follow steps 4.1 to 4.4).


7.2.2) Click on next tab Aggregation -> select an aggregation rule from Default aggregation rule dropdown list and click ok.

7.2.3) The logical column icon will change its color automatically after applying the aggregation rule, this will show that any aggregation rule is applied on that column.


7.3) Creating a measure/ logical column Derived from physical columns mappings and applying Aggregation Rule Based on Dimension Hierarchy. 

7.3.1) Create a column and then select column source tab-> select Derived from physical source mappings. (Follow steps 4.1 to 4.4).




7.3.2) Click on the Expression builder   -> select and aggregate (aggregation rule) and click on the insert selected item  



7.3.3) Select logical tables from top left pane Category->select a fact table from Logical tables pane then select a measure from bottom pan -> click on <<numExpr>> -> click insert selected item arrow key  and click ok.


7.3.4) Check out the aggregation expression formula in Aggregation tab.


7.3.5) Click on green plus sign   to add more formula based on logical dimension.



7.4) Creating Time Series Measures

Creating Ago Measure -> first of all you need to identify Time Dimension and set Chronological Key.

7.4.1) Here H0 Time is a time dimension-> double click on HO Time Dimension and select  Time  in the structure section -> and also set chronological key for all its levels as shown in the below screen shot.


7.4.2) Create a new logical column and select Derived from existing logical column using an expression-> click on Edit Expression button .

7.4.3) select Function from category pane-> Time Series from Function and Ago from Time Series


Functions. 
                                              
7.4.4) Select Logical Tables from category-> Select a logical table from Logical Tables-> select a column from columns then click on Measures in Ago function expression ->Click insert Selected Items  .


7.4.5) After this select Time Dimension from Category-> Select Time Dimension name from Time Dimensions-> Select a level of dimension from bottom pane-> Click on Level and then click Insert Selected Items.

Also click on Number of Periods and enter a numeric value-> Click OK and verify.


For two months Ago or more just change the number of period value and similarly create year, Quarter ago measures.

7.4.6) Check the new derived column and its expression.


Creating To date Measure

7.4.7) Create a new logical column and select Derived from existing logical column using an expression-> click on Edit Expression button.

7.4.8) select Function from category pane-> Time Series from Function and TODATE from Time Series Functions.
7.4.9) Select Logical Tables from category-> Select a logical table from Logical Tables-> select a column from columns then click on Measures in TODATE function expression ->Click insert Selected Items .
7.4.10) Now select Time Dimension from Category->Select Time Dimension name from Time Dimensions->Select a level of dimension from bottom pane-> Click on Level and then click Insert Selected Items .


7.5) Creating a measure/ logical column from existing logical columns, Repository Variables and using Display Function Filter.

7.5.1)
Create a new logical column and select Derived from existing logical column using an expression-> click on Edit Expression button.

7.5.2) Select Function from category pane-> Display Function from Function and Filter from Display Functions.



7.5.3) Select Logical Table from category pane-> a Logical table from Logical tables -> Logical column from columns then Select <<numExpr>>  -> click Insert Selected Items .


7.5.4) Select another column from logical table -> Click on <<expr>> after Using and click Insert Selected Items  -> now enter a minus sign (-) { to subtract values of one column from another column}-> and follow the same step to insert another column.

(Similarly you can apply or use more mathematical functions like division, addition, multiplication etc.)




7.5.6). Now add a less than sign (<) after this formula and add a variable after that.

Select Repository Variables from Category pane-> select a repository variable -> Put cursor behind less than sign and click on Insert selected items -> click ok.


7.5.7) Look at the final view of this new logical column created from existing logical columns and static variables.



7.6) Creating a measure/ logical column derived from existing logical columns  using Conversion Function  and Calender Date/ Time Function.

7.6.1) Select Functions from category-> select Conversion Function from functions-> Cast from Conversion function pane.


7.6.2) Select Functions from category ->Select Calendar Date/ Time functions from

functions -> TimestampDiff from Calendar Date/ Time functions -> Select <<numExpr|NULL>> from CAST function and click on Insert selected items. 



7.6.3) Select Interval and type DAY-> select a logical column and click on first timestampExpr -> and click on Insert selected items.
Select a logical column and click on second timestampExpr  -> and click on Insert selected items.


7.6.4) Select Types from Category ->Double from Types -> click on <<types>> -> and click on Insert selected items and add +1 after bracket.


7.7) Creating a measure/ logical column derived from existing logical columns  using Conversion Function  and Calender Date/ Time Function and EXTRCT. Type extract before the syntax.



8).Creating Business Model Diagram

Create business/ logical model diagram using relationships between dimension and fact tables as below diagram.



9. Use Tab 3, 4,5,6,7 from excel sheet for more details about BMM layer and follow to create logical tables, logical table source, logical columns, logical dimension hierarchies etc.

No comments:

Post a Comment