Tuesday, November 1, 2011

Adding Calculations


Adding calculations to fact means creating new computed measure columns into fact by applying calculation formulas, aggregation rules on existing logical column in BMM Layer to meet the business requirement. These computed measures help end users to get updates such as difference between two different years’ sales, total growth, difference between units sold and units ordered, ago sales, Profit, Expenses etc.

There are three ways to add calculations to FACT or creating measures or new computed columns.

1. Using physical columns as objects in a formula.
2. Using Existing Logical Columns.
3. Using the Calculation Wizard to add calculations.



1. Using physical columns as objects in a formula.

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

This measure 5-01 Inventory (Sum All) is created to calculate inventory of a year/quarter/ month/day. (Inventory is defined as assets that are intended for sale, are in process of being produced for sale or are to be used in producing goods.)

1.2). Click on Column Source tab-> Select radio button for Derived from Physical Mappings->Select Check box to Show all Logical Sources.


1.3). Double click on a Logical Table Source-> In Logical table source window see the new logical column name -> Click on Column Mapping.


1.4). Click on physical table drop down to select Physical Table Source-> Select a column from Expression and check out the mapping-> Click ok.


1.4). You can also create a logical column using Edit Expression button-> Click ok


1.5). Now select Aggregation Tab to apply a default Aggregation Rule.


1.6). Check out the Icon Differences and verify. 


1.7). A business requirement needs to show inventory for all the months of a year like below report


1.8). Now check into OBI Answers using 5-01 Inventory (Sum All) measure how this business requirement gets satisfied.  


1.9) Sql script generated by OBI Server for the requested report.



1.9) Aggregation Rule Based on Dimension Hierarchy.  

1.10) In Aggregation tab Select Based on dimension->Click on others.


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


1.12) 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.


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


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



1.15) A business requirement needs to show result like below using this measure 1-44 Revenue(Lst oT All)  based on dimensions for all months of a year.


1.16) Now check into OBI Answers using 1-44 Revenue(Lst oT All)  measure how this business requirement gets satisfied.


1.17)  Sql script generated by OBI Server for the requested report. 


2. Using Existing Logical Columns.
Instance1.  (1-23 Revenue (R3M Daily Avg))

This measure 1-23 Revenue (R3M Daily Avg) is created to calculate Running Daily Average Revenue of a year/quarter/ month/day.

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

2.2). Click on Column Source tabà Select radio button for Derived from Existing Logical Column using an expressionà Click on Edit Expression button. (This column doesn’t have any column mapping from Logical table source).  


2.3). Select logical column from logical table-> Divide the column from  variable using Repository Variable (Enter a slash or punctuation to divide) ->multiply Repository Variable with a value, enter an asterisk and value (* 30.4) -> put the whole formula into bracket shown in below screen shot-> Click ok.


2.4). Check out the formula for new computed column, The aggregation rule property invisible for this column and default aggregation rule which is applied for its parent column previously.


2.5) A business requirement needs to show result like below using this measure 1-23 Revenue (R3M Daily Avg) based on dimensions daily basis like below


2.6) Check into OBI Answers using 1-23 Revenue (R3M Daily Avg) measure how this business requirement gets satisfied.


2.7) Sql script generated by OBI Server for the requested report.


Instance 2.  

Quick Ratio: - This ratio is obtained by dividing the 'Total Assets' by 'Total Current Liabilities'. Sometimes a company could be carrying heavy inventory as part of its current assets, which might be obsolete or slow moving. Thus eliminating inventory from current assets and then doing the liquidity test is measured by this ratio. It expresses the true 'working capital' relationship of its cash, accounts receivables, prepaids and notes receivables available to meet the company's current obligations.

Follow Steps 2.2 to 2.6 to create Quick Ratio computed measure using existing logical columns.


A business requirement needs to show result like below using this measure Quick Ratio based on dimensions for all months of a year..


Check into OBI Answers using Quick Ratio measure how this business requirement gets satisfied.



Sql script generated by OBI Server for the requested report.


Instance3.

Gross Margin: - is the difference between selling price and cost. The purpose of margins is to determine the value of incremental sales, and to guide pricing and promotion decision. Gross margin is the difference between revenue (Pretax Income) and cost  (Sales) before accounting for certain other costs. Generally, it is calculated as the selling price of an item, less the cost of goods sold (production or acquisition costs, essentially). 

Follow Steps 2.2 to 2.6 to create Quick Ratio computed measure using existing logical columns


A business requirement needs to show result like below using this measure Gross Margin based on dimensions for all months of a year


Check out in OBI Answers using Gross Margin measure how this business requirement gets satisfied.


Sql script generated by OBI Server for the requested report.


3. Adding Calculations Using the Calculation Wizard to add calculations.

Pentagon: 3The Calculation Wizard can create up to four calculation measures. The wizard also prompts you to specify what value should be returned if the column has no value (like null). This must be specified for all selected calculations. Select each calculation and specify what value should be returned. You can enter any numeric value or NULL but don’t enter a value that would change the data type. You can also change the calculation name at this point which appears in the business model when the Calculation Wizard finishes.

3.1). Select a logical column ->Right-click and select Calculation Wizard.

3.2). In the first introduction screen click on next button


3.3). Select a Fact table and a column to compare with the previously selected column {1-01 Revenue (Sum All)} for calculation -> Click next.


3.4). In new calculation window, Go to Generate New Calculations-> Select Change and Percentage Change (If they are not appearing by default selected). -> Change the calculation name as you wish->Click Next.


3.5). In the next screen it will show a message that calculation wizard will create following calculations-> Click on the Finish button to create two new calculated columns



3.6). Check out the new computed column created using calculation wizard automatically.


A business requirement needs to show result like below using this measure Chg 2-01 Billed Qty(Sum All) and  %Chg-01 Billed Qty(Sum All) based on dimensions for all months of a year.


Check out in OBI Answers using Gross Margin measure how this business requirement gets satisfied


Sql script generated by OBI Server for the requested report.



Managing Logical Table Sources


 
Logical table sources define the mappings from a single logical table to one or more physical tables. A logical table contains one or more physical table source mapped. 

The logical table source also contains mapping information between logical table’s and physical tables and also between its logical columns and physical columns.


1. Creating Logical Tables.

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

Give a name for logical table




2. Creating Logical Table Sources. 

Create logical table sources for all the logical tables, 

2.1 Select a table (Here D0 Time table is selected) -> Right click, elect New Object-> Logical Table Source. 


2.2 Now give a name for logical table source àclick on the green + plus sign.      


2.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).       
                 

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


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



Create Logical table from multiple physical sources for Fact Tables

2.6 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 2.1 to 2.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. Creating Logical columns 

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: - Follow the below steps.
3.1) Right click on table -> select New Object -> Logical Column -> click on General tab enter name for the new logical column.




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



3.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.




3.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.


3.5) Similarly using above steps one logical column can be mapped from multiple physical columns.


3.6) Creating logical column derived from existing logical column (using existing logical column).

Create a new logical column-> Click on Column Source tab->  Select Derive from existing columns using an expression then Click on Edit Expression.


3.7)  Select Logical Tables from Category ->Select a logical table from Logical Tables-> Select an existing logical column from Columns ->click on Insert Selected Items -> Click ok.


3.8) Check out the expression for new logical column -> Derived from Existing Logical Columns.


3.9) You can also apply a formula to create a computed column as shown below using existing logical column.


3.10) Logical column can be created without mapping from any physical or logical column which result nothing when requested in query and can be used as a dummy object.





4). Assign Keys to logical tables.


4.1). Double click on a logical table for Logical table properties-> Click on Keys tab-> click below Key Name, enter a name for key column.


4.2). Click below columns to select a column from drop down to map with key column.


4.3). Check out the key assigned.


4.4). Check out the key column inside the table with all logical columns with different icon.


Monday, October 31, 2011





Testing and Validating a Repository 

After Building the business model and Presentation layer you need to test the repository begin by checking the repository for errors using the Check Global Consistency option.  

Run a Consistency Check

Click on the File Menu go to Check Global Consistency and click on it.


The Consistency Check Manager displays three types of messages.



The Consistency Check Manager

For each message the Consistency Check Manager identifies the message type, the object type, the object and provides a detailed description of the message. There are options to display only selected message types, display results using qualified names check all objects in the repository and copy the results to another file.

Before Global Consistency Check the red mark appear on the schema in Business Model and mapping Layer



To test your RPD it’s necessary to write your RPD file name in the   NQSConfig.ini file which located in \OBIEE_SERVER\server\Config and save it. 



Use Oracle BI Answers to Execute Queries  

You need to start or restart all your services Oracle BI Server, Oracle BI Presentation Server and Oracle BI Java Host services and also your data source properly.
 


  •   Start >
  •   Programs >
  •   Oracle Business Intelligence >
  •   Presentation Services.

Log in to Oracle Business Intelligence as Administrator



After login to OBI Click the Answers link in the Dashboard




Click on SALES in the subject areas it shows your RPD.