Download presentation
Presentation is loading. Please wait.
1
Adding Calculations to a Fact
Schedule: Timing Topic 30 minutes Lecture 45 minutes Practice 75 minutes Total
2
Oracle BI Suite EE 10g R3: Build Repositories 7 - 2
Objectives After completing this lesson, you should be able to: Describe a calculation measure and its use in a business model Create new calculation measures based on logical columns Create new calculation measures based on physical columns Create new calculation measures by using the Calculation Wizard Objectives Calculations enable data to be processed to derive measures that are valuable in analysis. Oracle BI Suite EE 10g R3: Build Repositories
3
Oracle BI Suite EE 10g R3: Build Repositories 7 - 3
Business Problem Businesses need to track the effectiveness of their operations. Businesses want to use business—rather than technical—language to ask business questions. For example: Show me the accounts receivable balance as of Q3. Some information is derived from other data such as: Derive money outstanding. Compare amount billed with amount received. Derive units backordered. Compare units ordered with units shipped. Business Problem Often, a business wants to compare values of a measure and needs a calculation to express the comparison. For example, a business might want to compare the number of units ordered with the number of units that have actually shipped. The business might want to see this comparison in terms of actual units or a percentage. The business wants its users to be able to formulate business questions using terminology they understand. Oracle BI Suite EE 10g R3: Build Repositories
4
Oracle BI Suite EE 10g R3: Build Repositories 7 - 4
Business Solution Oracle BI Server provides utilities to create calculation measures in the business model. Use the Expression Builder to create new logical columns with a calculation formula. Use existing logical columns or physical columns as objects in the formula. Use the Calculation Wizard to create calculation measures based on existing logical columns. Add calculation measures to the Presentation layer so that users can pose business questions in Answers by using familiar terminology. Business Solution To meet the needs of various business measures, Oracle BI Server has a calculation engine to perform a multitude of calculations. Calculation measures enable users to make inquiries such as “Show me the accounts receivable balance as of Q3” or “Show me the difference between units ordered and units shipped.” The Expression Builder enables you to create expressions that are similar to expressions created with SQL. You use the Expression Builder to create calculation measures based on logical or physical columns that appear as a single column in Answers. You use the Calculation Wizard to create calculation measures based on existing logical columns. Users can then easily build queries using familiar terminology. Oracle BI Suite EE 10g R3: Build Repositories
5
Oracle BI Suite EE 10g R3: Build Repositories 7 - 5
ABC Example ABC wants to create a calculated measure, Cuts, that tracks the difference between units ordered and units shipped. Implement a new measure that calculates Cuts. ABC Example Payment for an order is not due until ABC ships its products. Therefore, shipment delays have a significant impact on ABC’s cash flow. ABC wants to create a calculated measure, Cuts, that tracks the difference between units ordered and units shipped. Cuts can affect customer satisfaction and, potentially, can result in lost revenue. The Cuts calculation measure is modeled in the SupplierSales business model and made available to users as a column in Oracle BI Answers. Oracle BI Suite EE 10g R3: Build Repositories
6
Implementation Methods
Calculation measures can be created using: Existing logical columns as objects in a formula Physical columns as objects in a formula The Calculation Wizard to automate the process The Calculation Wizard creates new measure columns that compare two existing logical columns in a formula. Implementation Methods There are three methods for creating calculation measures: Use existing logical columns as objects in a formula. Use physical columns as objects in a formula. Use the Calculation Wizard to automate the process. All three methods for creating calculation measures are covered in detail in subsequent slides. Oracle BI Suite EE 10g R3: Build Repositories
7
Steps for Using Existing Logical Columns
Create a new logical column. Specify logical columns as the source. Build a formula. Steps for Using Existing Logical Columns These are the high-level steps for creating a calculation measure using existing logical columns. Each step is described in detail in subsequent slides. Oracle BI Suite EE 10g R3: Build Repositories
8
1. Create a New Logical Column
Right-click the fact table and select New Object > Logical Column. Enter the name for the new column. 1. Create a New Logical Column Start by creating a new logical column (Cuts, in this example) in the fact table. Oracle BI Suite EE 10g R3: Build Repositories
9
2. Specify Logical Columns as the Source
Select the “Use existing logical columns as the source” check box. 2. Specify Logical Columns As the Source Select “Use existing logical columns as the source” on the General tab of the column properties to specify that you want to use existing logical columns in the calculation for the new Cuts column. Oracle BI Suite EE 10g R3: Build Repositories
10
Oracle BI Suite EE 10g R3: Build Repositories 7 - 10
3. Build a Formula Open the Expression Builder and build the calculation formula using existing logical columns. 3. Build a Formula Open the Expression Builder to create the calculation formula (Units Ordered minus Units Shipped) using the existing logical columns. After you finish, Cuts appears as a new logical column in the fact table. If there are any aggregation rules applied to the logical columns, those aggregation rules are automatically applied in the formula. In this example, both Units Ordered and Units Shipped already have SUM aggregation rules applied. (Recall that you applied these rules in an earlier lesson.) Thus the calculation formula is sum(Units Ordered) – sum(Units Shipped). After you finish, Cuts appears as a logical column for the SalesFacts logical fact table in the Business Model and Mapping layer. Click the ellipsis button to open the Expression Builder. Oracle BI Suite EE 10g R3: Build Repositories
11
Steps for Using Physical Columns
Create a new logical column. Map the new column. Build the formula. Specify an aggregation rule. Steps for Using Physical Columns These are the high-level steps for creating a calculation measure using physical columns. Each step is described in the subsequent slides. Oracle BI Suite EE 10g R3: Build Repositories
12
1. Create a New Logical Column
Right-click the fact table and select New Object > Logical Column. Enter the name for the new column. Deselect. 1. Create a New Logical Column Start by creating a new logical column (CutsP, in this example) in the fact table. Ensure that the “Use existing logical column as the source” check box is deselected to specify that physical columns are used as the source in the calculation for the new CutsP column. Oracle BI Suite EE 10g R3: Build Repositories
13
Oracle BI Suite EE 10g R3: Build Repositories 7 - 13
2. Map the New Column Use the Column Mapping tab of the Logical Table Source dialog box to open the Expression Builder for the new column. Show unmapped columns. 2. Map the New Column To access the Expression Builder, open the properties dialog box for the existing logical table source, D1_ORDERS2 in this example. On the Column Mapping tab, locate the (as yet) unmapped column CutsP and click the ellipsis button to open the Expression Builder. Click to open the Expression Builder. Oracle BI Suite EE 10g R3: Build Repositories
14
Oracle BI Suite EE 10g R3: Build Repositories 7 - 14
3. Build the Formula Build the calculation formula using physical columns. 3. Build the Formula Using the Expression Builder, create the calculation formula using the physical columns UNITORDD and UNITSHPD. By selecting physical columns as objects in the formula, a column mapping is also configured for the new column. After you finish, CutsP appears as a logical column for the SalesFacts logical fact table in the Business Model and Mapping (BMM) layer. Column mapping Oracle BI Suite EE 10g R3: Build Repositories
15
4. Specify an Aggregation Rule
Click the Aggregation tab and set the aggregation rule for the CutsP column. Set the aggregation rule. Double-click to open the properties dialog box. 4. Specify an Aggregation Rule Double-click the new CutsP logical column to open the column properties dialog box and click the Aggregation tab. You need to set the aggregation rule because you are using physical columns, not logical columns, in the calculation formula. Recall that there are SUM aggregation rules set for the Units Ordered and Units Shipped logical columns, but not for the corresponding physical columns. The calculation formula using logical columns looks like this: sum(Units Ordered) – sum(Units Shipped), whereas the calculation formula using physical columns looks like this: sum(UNITORDD – UNITSHPD) In this example, because of arithmetic laws, you know that you can sum ColumnA and sum ColumnB and then take the differences of those sums, and have the same results if you calculate the difference first (the value in ColumnA – the value in ColumnB for each row) and then sum the difference. Oracle BI Suite EE 10g R3: Build Repositories
16
Steps for Using the Calculation Wizard
Open the Calculation Wizard. Choose the columns for comparison. Select the calculations. Confirm the calculation measures. New calculation measures are added. Steps for Using the Calculation Wizard These are the high-level steps for creating calculation measures using the Calculation Wizard. Each step is described in the subsequent slides. Oracle BI Suite EE 10g R3: Build Repositories
17
1. Open the Calculation Wizard
Right-click a logical column that you want to use in the calculation and select Calculation Wizard. 1. Open the Calculation Wizard This slide shows how to start the Calculation Wizard. In this example, right-click Units Ordered and select Calculation Wizard to launch the wizard. Oracle BI Suite EE 10g R3: Build Repositories
18
2. Choose the Columns for Comparison
The wizard prompts you to select the columns that you want to compare with Units Ordered. In this example, Units Shipped is selected. Oracle BI Suite EE 10g R3: Build Repositories
19
3. Select the Calculations
The wizard prompts you to select the calculations you want to model (Change and Percent Change in this example). The Calculation Wizard can create up to four calculation measures (Change, Percent Change, Index, and Percent). The wizard also prompts you to specify what value should be returned if the column has no value (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. Do not enter a value that would change the data type. For example, do not enter NA, which is a character value, and not a numeric value. You can also change the calculation name at this point. This is the name that appears in the business model when the Calculation Wizard finishes. In this example, the calculation measure that calculates the difference between Units Ordered and Units Shipped is renamed CutsW. Oracle BI Suite EE 10g R3: Build Repositories
20
4. Confirm the Calculation Measures
The Calculation Wizard identifies the two calculation measures that it creates. Click Finish to add the new measures to the fact table. Oracle BI Suite EE 10g R3: Build Repositories
21
5. New Calculation Measures Are Added
New calculation measures are automatically added to the business model. 5. New Calculation Measures Added When you click Finish, the new calculation measures are automatically added to the business model. Oracle BI Suite EE 10g R3: Build Repositories
22
Add New Measures to the Presentation Layer
Add new calculation measures to the Presentation layer regardless of the method used to create the measures. Oracle BI Suite EE 10g R3: Build Repositories
23
Examining a Query Using Physical Columns
Use physical columns for calculations that require an aggregation rule to be applied after the calculation. Query uses a calculation measure based on physical columns. SQL calculates difference between Units Ordered and Units Shipped and applies the aggregation rule after the calculation. Examining a Query Using Physical Columns You use physical columns for calculations that require that an aggregation rule be applied after the calculation. This slide examines the query log for a query that uses the CutsP calculation measure, which was built using physical columns in the formula. In this case, the SQL calculates the difference between Units Ordered (UNITORDD) and Units Shipped (UNITSHPD), and then applies the SUM aggregation rule. This is expressed as sum(UNITORDD – UNITSHPD). This is easily determined by knowing when an aggregation rule is applied in the calculation. Use logical columns when the aggregation rule is applied before the calculation. Use physical columns when the aggregation rule is applied after the calculation. The next slide provides an example of when to configure a calculation measure based on physical columns. Oracle BI Suite EE 10g R3: Build Repositories
24
Example: Using Physical Columns
To calculate total revenue accurately, multiply the Unit Price by the number of Units Sold for each row, and then apply the SUM aggregation rule to the total. Example: Using Physical Columns In this example the calculation measure Total Revenue is based on physical columns and the aggregation rule is applied after the calculation. Total revenue is derived by calculating, row-by-row, the unit price times units sold and then applying the SUM aggregation rule after the calculation to find total revenue, which equals $3,400. What would happen if the aggregation rule was applied before the calculation? In other words, what would happen if the calculation measure Total Revenue was based on logical columns? Applying the summation (aggregation rule) before the calculation is as follows: Unit price $500 + $400 + $300 = $1,200 Units sold = 9 The calculation is then: $1,200 9 = $10,800 This calculation is not correct. Applying the aggregation rule (summing the unit price and the units sold) before the calculation (unit price * units ordered) does not give total revenue accurately. Oracle BI Suite EE 10g R3: Build Repositories
25
Examining a Query Using Logical Columns
Use logical columns for calculation formulas that require an aggregation rule that is applied before the calculation. Query uses a calculation measure based on logical columns. … and then calculates the difference. SQL first applies the aggregation rules to the columns … Examining a Query Using Logical Columns Use logical columns for calculation formulas that require an aggregation rule that is applied before the calculation. This slide examines the query log for a query that uses the Cuts calculation measure, which was built using existing logical columns in the formula. In this case, the SQL applies the SUM aggregation rule to Units Ordered (UNITORDD) and Units Shipped (UNITSHPD) first and then calculates the difference. This is expressed in this example as D1.c1 – D1.c2. The next slide provides an example of when to configure a calculation measure based on logical columns. Oracle BI Suite EE 10g R3: Build Repositories
26
Example: Using Logical Columns
To accurately calculate unit price, sum Total Price and Units Sold first and then divide Total Price by Units Sold to determine Unit Price. Example: Using Logical Columns In this example, the calculation measure Unit Price is based on logical columns; therefore, the aggregation rule is applied before the calculation. Unit Price is found by applying the SUM aggregation rule to both Total Price and Units Sold before calculating the unit price (dividing Total Price by Units Sold). Oracle BI Suite EE 10g R3: Build Repositories
27
Examining a Query Using the Calculation Wizard
The Calculation Wizard uses logical columns as objects in its calculations, so aggregation rules are applied before the calculation. Query uses a calculation measure built by the wizard. … and then calculates the difference. SQL first applies the aggregation rules to the columns … Examining a Query Using the Calculation Wizard When using the Calculation Wizard to model calculation measures, it is important to consider that the wizard uses logical columns as objects in the calculation formulation; therefore, an aggregation rule is applied before the calculation. Oracle BI Suite EE 10g R3: Build Repositories
28
Oracle BI Suite EE 10g R3: Build Repositories 7 - 28
Summary In this lesson, you should have learned how to: Describe a calculation measure and its use in a business model Create new calculation measures based on existing logical columns Create new calculation measures based on physical columns Create new calculation measures by using the Calculation Wizard Instructor Note Review Questions Question: Why are calculation measures important to a business? Answer: Calculation measures enable businesses to track the effectiveness of their operations. Question: What utility in the Administration Tool enables you to model a calculation measure using existing columns as objects in a formula? Answer: The Expression Builder utility Question: When should you use physical columns for calculation formulas? Answer: Use physical columns when an aggregation rule is applied after the calculation. Question: When should you use logical columns for calculation formulas? Answer: Use logical columns when an aggregation rule is applied before the calculation. Oracle BI Suite EE 10g R3: Build Repositories
29
Oracle BI Suite EE 10g R3: Build Repositories 7 - 29
Practice 7-1 Overview: Creating Calculation Measures by Using Logical Columns This practice covers creating a calculation measure by using existing logical columns. Practice 7-1 Overview: Creating Calculation Measures by Using Logical Columns You want users to be able to track the difference between the units ordered and units shipped by selecting a single fact column called Cuts. This important business measure can potentially help track lost revenue. You use the Expression Builder to configure a formula for Cuts using existing logical columns as objects in the formula. Oracle BI Suite EE 10g R3: Build Repositories
30
Oracle BI Suite EE 10g R3: Build Repositories 7 - 30
Practice 7-2 Overview: Creating Calculation Measures by Using Physical Columns This practice covers creating a calculation measure by using physical columns. Practice 7-2 Overview: Creating Calculation Measures by Using Physical Columns You want users to be able to track the difference between the units ordered and units shipped by selecting a single fact column called CutsP. You use the Expression Builder to configure a formula for CutsP using physical columns as objects in the formula. Oracle BI Suite EE 10g R3: Build Repositories
31
Oracle BI Suite EE 10g R3: Build Repositories 7 - 31
Practice 7-3 Overview: Creating Calculation Measures by Using the Calculation Wizard This practice covers creating a calculation measure by using the Calculation Wizard. Practice 7-3 Overview: Creating Calculation Measures by Using the Calculation Wizard You use the Calculation Wizard to model two calculation measures: Chg Units Shipped and % Chg Units Shipped. The Chg Units Shipped measure calculates the difference between the units ordered and units shipped. The % Chg Units Shipped measure calculates the percentage of units ordered that has not been shipped. The calculation measures that are created by the wizard are based on existing logical columns. You rename these columns CutsW and Percent Not Shipped in the Presentation layer. Oracle BI Suite EE 10g R3: Build Repositories
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.