Click OK. Click OK or Cancel to close the Dimensions dialog.

9-6 Metadata Repository Builders Guide for Oracle Business Intelligence Enterprise Edition

3. For Number of elements at this level, specify the number of elements that exist at

this logical level. If this level will be the Grand Total level, leave this field blank. The system will set to a value of 1 by default. The number does not have to be exact, but ratios of numbers from one logical level to another should be accurate. For relational sources, you can retrieve the row count for the level key and use that number as the number of elements. For multidimensional sources, you can use the number of members at that level. The Oracle BI Server uses this number when selecting which aggregate source to use. For example, when aggregate navigation is used, multiple fact sources exist at different grains. The Oracle BI Server multiplies the number of elements at each level for each qualified source as a way to estimate the total number of rows for that source. Then, the Oracle BI Server compares the result for each source and selects the source with the lowest number of total elements to answer the query. The source with the lowest number of total elements is assumed to be the fastest. 4. Choose one of the following options, if appropriate: – If the logical level is the Grand Total level, select Grand total level. There should be only one Grand Total level for a dimension. – If measure values at a particular level fully constitute aggregated measures at its parent level, select Supports rollup to higher level of aggregation. 5. To define child logical levels, click Add. 6. In the Browse dialog, select the child logical levels and click OK. The child levels appear in the Child Levels pane. 7. To remove a previously defined child level, select the level in the Child Levels pane and click Remove. The child level and all of its child levels are deleted from the Child Levels pane. 8. Optional Type a description of the logical level.

9. Click OK.

Associating a Logical Column and Its Table with a Dimension Level After you create all logical levels within a dimension, you need to drag and drop one or more columns from the dimension table to each logical level except the Grand Total level. The first time you drag a column to a dimension it associates the logical table to the dimension. It also associates the logical column with that level of the dimension. To change the logical level to be associated with that logical column, you can drag a column from one logical level to another. The logical column or columns that comprise the logical key of a dimension table must be associated with the lowest level of the dimension. After you associate a logical column with a dimension level, the tables in which these columns exist appear in the Tables tab of the Dimensions dialog. For time dimensions, ensure that all time-related logical columns in the source table are defined in the time dimension. For example, if a time-related logical table contains the columns Month Name and Month Code, you must ensure that both columns are dragged to the appropriate level within the dimension. Figure 9–2 shows how to associate logical columns with a logical level. Working with Logical Dimensions 9-7 Figure 9–2 Associating Logical Columns with a Logical Level To verify tables that are associated with a dimension: 1. In the Business Model and Mapping layer of the Administration Tool, double-click a dimension. 2. In the Dimensions dialog, click the Tables tab. The tables list contains tables that you associated with that dimension. This list of tables includes only one logical dimension table and one or more logical fact tables if you created level-based measures.

3. Click OK or Cancel to close the Dimensions dialog.

Example 9–1 and Example 9–2 show how to associate measures to different levels of level-based dimension hierarchies. Example 9–1 Level-Based Measure Calculations A level-based measure is a column whose values are always calculated to a specific level of aggregation. For example, a company might want to measure its revenue based on the country, based on the region, and based on the city. You can set up columns to measure CountryRevenue, RegionRevenue, and CityRevenue. When a query includes a level-based measure column, and the query grain is higher than the level of aggregation specific to the column, the query results return null. Note that in previous releases, results were returned for this situation, but they were not deterministic. The measure AllProductRevenue is an example of a level-based measure at the Grand Total level. Level-based measures allow a single query to return data at multiple levels of aggregation. They are also useful in creating share measures, that are calculated by taking some measure and dividing it by a level-based measure to calculate a percentage. For example, you can divide salesperson revenue by regional revenue to calculate the share of the regional revenue each salesperson generates. 9-8 Metadata Repository Builders Guide for Oracle Business Intelligence Enterprise Edition To set up these calculations, you need to build a dimensional hierarchy in your repository that contains the levels Grandtotal, Country, Region, and City. This hierarchy contains the metadata that defines a one-to-many relationship between Country and Region and a one-to-many relationship between Region and City. For each country, there are many regions, but each region is in only one country. Similarly, for each region, there are many cities, but each city is in only one region. Next, you need to create three logical columns CountryRevenue, RegionRevenue, and CityRevenue. Each of these columns uses the logical column Revenue as its source. The Revenue column has a default aggregation rule of SUM and has sources in the underlying databases. You then drag the CountryRevenue, RegionRevenue, and CityRevenue columns into the Country, Region, and City levels, respectively. Each query that requests one of these columns returns the revenue aggregated to its associated level. Figure 9–3 shows what the business model in the Business Model and Mapping layer looks like for this example. Figure 9–3 Example of Business Model in the Business Model and Mapping Layer In the Geography Dimension, the CountryRevenue and RegionRevenue columns are attributes of the Country and Region levels. In the Sales Facts table, the Revenue column has a default aggregation rule of SUM and is mapped to physical detail data or physical aggregate data. CountryRevenue and RegionRevenue columns use the Revenue column as their source. Example 9–2 Grand Total Dimension Hierarchy You might have a product dimensional hierarchy with levels TotalProducts Grand Total level, Brands, and Products. Additionally, there might be a column called Revenue that is defined with a default aggregation rule of Sum. You can then create a logical column, AllProductRevenue, that uses Revenue as its source as specified in the General tab of the Logical Column dialog. Now, drag AllProductRevenue to the Grand Total level. Each query that includes this column returns the total revenue for all products. The value is returned regardless of any constraints on Brands or Products. If you have constraints on columns in other tables, the grand total is limited Working with Logical Dimensions 9-9 to the scope of the query. For example, if the scope of the query asks for data from 1999 and 2000, the grand total product revenue is for all products sold in 1999 and 2000. If you have three products, A, B, and C with total revenues of 100, 200, and 300 respectively, then the grand total product revenue is 600 the sum of each products revenue. If you have set up a repository as described in this example, the following query produces the results listed: SELECT product, productrevenue, allproductrevenue FROM sales_subject_area WHERE product IN A or B The results are as follows: PRODUCT PRODUCTREVENUE ALLPRODUCTREVENUE A 100 600 B 200 600 In this example, the AllProductRevenue column always returns a value of 600, regardless of the products on which the query constrains. Identifying the Primary Key for a Dimension Level Use the Keys tab in the Logical Level dialog to identify the primary key for a level. To specify a primary key for a dimension level: 1. In the Business Model and Mapping layer of the Administration Tool, expand a dimension and then expand the highest level Grand Total level of the dimension. 2. Double-click a logical level below the Grand Total level. 3. In the Logical Level dialog, click the Keys tab.

4. In the Keys tab, from the Primary key list, select a level key.