Friday 8 July 2016

Level Based Measures in OBIEE

A level-based measure is a column whose values are always calculated to a specific level of aggregation. It is useful to calculate share measures. A company wants to calculate Revenue share of each product, First you need to calculate Product Total (Revenue is aggregated to Product Total).
Creating Level-Based Measures
  1. In the BMM layer, right-click the F1 Revenue table and select New Object > Logical Column to open the Logical Column dialog box.
alt description here
  1. On the General tab, enter Product Total Revenue in the Name field.
alt description here




  1. Click the Column Source tab.
alt description here
  1. Select Derived from existing columns using an expression.
alt description here
  1. Open the Expression Builder.
alt description here
  1. In the Expression Builder, add Logical Tables > F1 Revenue > Revenue to the expression. Recall that the Revenue column already has a default aggregation rule of Sum.
alt description here
  1. Click OK to close Expression Builder.
  2. Click the Levels tab.
alt description here
  1. For the H2 Product logical dimension, select Product Total from the Logical Level drop-down list to specify that this measure should be calculated at the grand total level in the product hierarchy.
alt description here
  1. Click OK to close the Logical Column dialog box. The Product Total Revenue measure appears in the Product Total level of the H2 Product logical dimension and the F1 Revenue logical fact table.
alt description here
  1. Repeat the steps to create a second level-based measure:
Name
Logical Dimension
Logical Level
Product Type Revenue
H2 Product
Product Type

  1. alt description here
  2. Expose the new columns to users by dragging Product Total Revenue and Product Type Revenue to the Base Facts presentation table in the Sample Sales subject area in the Presentation layer. You can drag the columns from either the H2 Product logical dimension or the F1 Revenue logical table.
alt description here
 Creating a Share Measure
  1. In the BMM layer, right-click the F1 Revenue table and select New Object > Logical Column to open the Logical Column dialog box.
  2. On the General tab, name the logical column Product Share.
alt description here
  1. On the Column Source tab, select "Derived from existing columns using an expression".
alt description here
  1. Open the Expression Builder.
alt description here
  1. In the Expression Builder, Select Functions > Mathematic Functions > Round.
alt description here
  1. Click Insert selected item. The function appears in the edit box.
alt description here
  1. Click Source Number in the formula.
alt description here
  1. Enter 100* followed by a space.
alt description here
  1. Insert Logical Tables > F1 Revenue > Revenue.
alt description here
  1. Using the toolbar, click the Division button. Another set of angle brackets appears, <<expr>>.
alt description here
  1. Click <<expression>>.
alt description here
  1. Insert Logical Tables > F1 Revenue > Product Total Revenue. Recall that this is the total measure for the hierarchy.
alt description here
  1. Click between the last set of angle brackets, <<Digits>>, and enter 1. This represents the number of digits of precision with which to round the integer.
alt description here
  1. Check your work:

Round(100* "Sample Sales"."F1 Revenue"."Revenue" / "Sample Sales"."F1 Revenue"."Product Total Revenue" , 1) 
This share measure will allow you to run an analysis that shows how revenue of a specific product compares to total revenue for all products.
  1. Click OK to close the Expression Builder. The formula is visible in the Logical Column dialog box.
alt description here
  1. Click OK to close the Logical Column dialog box. The Product Share logical column is added to the business model.
alt description here
  1. Add the Product Share measure to the Base Facts presentation table.
alt description here
  1. Save the repository. Check consistency. You should receive the following message.
alt description here
If there are consistency errors or warnings, correct them before you proceed.
  1. Close the repository.
 Testing Your Work
  1. Return to Oracle Enterprise Manager and load the BISAMPLE repository.
  2. Return to Oracle BI, which should still be open, and sign in.
  3. Create the following analysis to test the level-based and share measures.
Products.Product
Base Facts.Revenue
Base Facts.Product Type Revenue
Base Facts.Product Share
alt description here
  1. For the Product Share column, select Column Properties.
alt description here
  1. On the Data Format tab, select Override Default Data Format.
alt description here
  1. Change Treat Numbers As to Percentage and set Decimal Places to 2. Deselect Use 1000's separator.
alt description here
  1. Click OK to close the Column Properties dialog box.
  2. Sort Product Share in descending order.
alt description here
  1. Click Results. Notice that Product Type Revenue returns dollars grouped by Type even though the query is at a different level than Type; Product in this example. Product Share shows the percent of total revenue for each product sorted in descending order.
alt description here

No comments:

Post a Comment