Each business model can have one or more dimensions, each dimension can have one or more logical levels, and each logical level has one or more attributes (columns) associated with it.
The following sections explain how to create dimensions:
A dimension contains two or more logical levels. When creating logical levels, you should create a Grand Total level and then create child levels, working down to the lowest level.
The following are the parts of a dimension:
The Grand Total level represents the sum of all totals for a dimension. Each dimension can have just one Grand Total level. The Grand Total level does not contain dimensional attributes and does not have a level key. You can associate measures with a Grand Total level. The aggregation level for those measures is the grand total for the dimension. The Grand Total level can exists without any columns.
Levels must have at least one column. You do not need to explicitly associate all of the columns from a table with logical levels. Any column that you do not associate with a logical level is automatically associated with the lowest level in the dimension that corresponds to that dimension table. You must associate all logical columns in the same dimension table with the same dimension.
You can have an unlimited number of levels in a dimension. When using extremely complex SQL queries, a few levels in a dimension can impact query performance.
Each dimension contains one or more hierarchies. All hierarchies must have a common leaf level. For example, a time dimension might contain a fiscal hierarchy and a calendar hierarchy, with a common leaf level of Day. In this example, Day has two named parent levels, Fiscal Year and Calendar Year that are both children of the All root level.
In the Business Model and Mapping layer, logical hierarchies are not defined as independent metadata objects, unlike hierarchies in the Presentation layer. Logical hierarchies exist implicitly through the relationships between levels.
You can define intermediate levels in your hierarchies to avoid having very large numbers of members at one level. For example, if you are creating a Product dimension for an automotive company that tracks data on 500 different car models, you might want to create some finer-grained hierarchical levels such as Minivans, Subcompacts, and Midsize Sedans. You could improve query performance and make reports and diagrams easier to read and navigate.
Each logical level, except the Grand Total level, must have one or more attributes that compose a level key. The level key defines the unique elements in each logical level. You must associate the dimension table logical key with the lowest level of a dimension.
A logical level can have multiple level keys. When a logical level has multiple level keys, specify a key as the primary key for the 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. Each logical level should have one level key that is displayed when an Oracle BI Server user selects the object to drill down. You can use any level key to provide user access to the level.
You must create an unique level key. Month is not an unique level key. To create an unique level key with month include the year attribute as part of the key.
If you do not ensure that your level key is unique by including higher-level attributes, then queries might return unexpected results. For example, when the Oracle BI Server needs to combine result sets from multiple physical queries, some expected rows might be dropped because they are not considered unique according to the level key definition.
Create meaningful level keys using common business keys such as Month_name='2010 July', rather than generated surrogate keys such as time_key='1023793'. The generated surrogate keys are physical artifacts that only apply to a single instance of a source table. A business key can map to any physical instance for that logical column, for example, month_name might map to a detailed table, an aggregate table from an aggregate star, or a column in a federated spreadsheet. The Physical layer uses the surrogate keys in the joins. Using a business key does not impose a performance or flexibility penalty in the business model.
You can identify a dimension as a time dimension. At least one level of a time dimension must have a chronological key. Use the following guidelines when setting up and using time dimensions:
At least one level of a time dimension must have a chronological key, see Selecting and Sorting Chronological Keys in a Time Dimension.
All time series measures using the AGO
, TODATE
, and PERIODROLLING
functions must be on time levels. AGO
, TODATE
, and PERIODROLLING
aggregates are created as derived logical columns.
AGO
, TODATE
, and PERIODROLLING
functionality is not supported either on fragmented dimensional logical table sources, or on fact sources fragmented on the same time dimension. Fact sources may be fragmented on other dimensions.
An unbalanced or ragged hierarchy is a hierarchy where the leaves (members with no children) might not have the same depth. For example, a site can choose to have data for the current month at the day level, previous months data at the month level, and the previous 5 years data at the quarter level.
User applications can use the ISLEAF function to determine whether to allow moving down from any particular member.
A missing member is implemented in the data source with a null value for the member value. All computations treat the null value as a unique child within its parent. Level-based measures and aggregate-by calculations group all missing nodes together.
Unbalanced hierarchies are not necessarily the same as parent-child hierarchies. Parent-child hierarchies are unbalanced by nature. Unbalanced level-based hierarchies are possible.
A skip-level hierarchy is a hierarchy where there are members that do not have a value for a particular ancestor level. For example, in a Country-State-City-District hierarchy, the city 'Washington, D.C.' does not belong to a State. In this case, you can drill down from the Country level (USA) to the City level (Washington, D.C.) and below.
In a query, skipped levels are not displayed, and do not affect computations. When sorted hierarchically, members appear under their nearest ancestors.
A missing member at a particular level is implemented in the data source with a null value for the member value. All computations treat the null value as a unique child within its parent. Level-based measures and aggregate-by calculations group all skip-level nodes together.
The image shows a hierarchy with both unbalanced and skip-level characteristics. For example, A-Brand 4, B-LOB 3, and Type 5 are unbalanced branches, while skips are present between A-Brand 2 and Type 3, B-LOB 2 and Product 6, and others.
Learn how to use dimension hierarchical levels.
Dimension hierarchical levels can be used to perform the following actions:
Set up aggregate navigation.
Configure level‐based measure calculations, see Level-Based Measure Calculations.
Determine what attributes appear when Oracle BI Presentation Services users drill down in their data requests.
Learn how to create and manage hierarchy level in level-based hierarchies.
Perform the tasks described in the following sections:
After creating a dimension, each dimension can be associated with attributes (columns) from one or more logical dimension tables and level-based measures from logical fact tables.
After you associate logical columns with a dimension level, the tables in which these columns exist appear in the Tables tab of the Dimension dialog. See Working with Physical Hierarchy Objects.
When creating logical levels in a dimension, you also create the hierarchy by identifying the type of level and defining child levels.
See Automatically Creating Business Model Objects for Multidimensional Data Sources.
If you are defining the level as a Grand Total level
, leave this field blank. The default value is 1.
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.
After you create all logical levels within a dimension, 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. The drag and drop action associates the logical column with that level of the dimension. To associate the logical level with that logical column, drag a column from one logical level to another.
You must associate the logical column or columns that comprise the logical key of a dimension table 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 examples, see:
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. The image shows how to associate logical columns with a logical level.
A level-based measure is a column whose values are always calculated to a specific level of aggregation.
You can set up columns to measure CountryRevenue, RegionRevenue, and CityRevenue. For example, a company might want to measure its revenue based on the country, region, and city.
When a query containing a presentation hierarchy 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. If the request only contains ordinary columns and no hierarchical columns, the level-based measure is not replaced with null.
The AllProductRevenue measure 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. Level-based measures are also useful in creating share measures, 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.
For example, to set up these calculations, you need to build a dimensional hierarchy in your repository that contains the Grandtotal, Country, Region, and City levels. 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.
After building a dimensional hierarchy, you need to create three logical columns one each for CountryRevenue, RegionRevenue, and CityRevenue. The columns use the Revenue logical column as its source. The Revenue column has a default aggregation rule of SUM
and has sources in the underlying databases.
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.
The image shows the business model in the Business Model and Mapping layer for this example.
Learn how to use a grand total dimensional hierarchy with revenue.
If you have a product dimensional hierarchy with TotalProducts (Grand Total level), Brands, and Products levels, and a Revenue column defined with a default aggregation rule of Sum, you can then create an AllProductRevenue logical column. The AllProductRevenue column uses Revenue as its source. Drag the AllProductRevenue column to the Grand Total level. Each query that includes the AllProductRevenue 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 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 product's 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
The AllProductRevenue column always returns a value of 600, regardless of the products on which the query constrains.
Use the Keys tab in the Logical Level dialog to identify the primary key for a level.
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.
Double-click a logical level below the Grand Total level.
In the Logical Level dialog, click the Keys tab.
In the Keys tab, from the Primary key list, select a level key.
If only one level key exists, it is the primary key by default.
To add a column to the list, perform the following steps:
In the Logical Level dialog, click New.
In the Logical Level Key dialog, type a name for the key.
In the Logical Level Key dialog, select a column or click Add.
If you click Add, in the Browse dialog, select the column, and then click OK.
The column you selected appears in the Columns list of the Logical Level Key dialog and is automatically selected.
Note:
You cannot use a derived logical column that is the result of a LOOKUP
function as part of a primary logical level key. This limitation exists because the LOOKUP
operation is applied after aggregates are computed, but level key columns must be available before the aggregates are computed because they define the granularity at which the aggregates are calculated.
You can use a derived logical column that is the result of a LOOKUP
function as a secondary logical level key.
If the level is in a time dimension, you can select chronological keys and sort the keys by name.
(Optional) Type a description for the key and then click OK.
Repeat Step 2 through Step 7 to add primary keys to other logical levels.
In the Logical Level dialog, click OK.
At least one level of a time dimension must have a chronological key. Although you can select one or more chronological keys for any level and then sort keys in the level, only the first chronological key is used.
You can use the Preferred Drill Path tab to identify the drill path to use when Oracle BI Presentation Services users drill down in their data requests.
You should use this only to specify a drill path that is outside the normal drill path defined by the dimensional level hierarchy. It is most commonly used to drill from one dimension to another. You can delete a logical level from a drill path or reorder a logical level in the drill path.
Adding absolute or relative sequence numbers to time dimensions optimizes time series functions and in some cases improves query time.
By default Oracle BI Server uses a complex RANK Physical SQL expression to generate sequence numbers for time dimensions. Adding an absolute or relative sequence number to the time dimension's logical level provides direct column references in the Time dimension table that contain the precomputed results of the rank expressions. This mapping, while optional, generates a simpler query that is easier for Oracle BI Server to execute against the data source.
Sequence numbers are enumerations of time dimensional members at a certain level. The enumeration must be dense (no gaps) and must correspond to a real time order. For example, months in a year can be enumerated from 1 to 12.
The sequence number type options are:
Absolute - Choose this option to configure an absolute sequence number when the column enumerates the members of the time dimension without any reference, for example, calendar year.
Relative - Chose this option to configure relative sequence numbers when you have a column that enumerates members of the time dimension relative to some parent level, for example, months in year which can be 1 to 12.
The Create Dimensions option is only available if the selected logical table is a dimension table as defined by 1:N logical joins, and a dimension has not been associated with the table.
The following rules are applied:
An automatically created dimension uses the same name as the logical table, adding Dim as a suffix. For example, if a table is named Periods, the dimension is named Periods Dim.
A Grand Total level is automatically named logical_table_name Total. For example, the Grand Total level of the Periods Dim table is Periods Total.
When there are multiple tables in a source, the join relationships between tables in the source determine the physical table containing the lowest-level attributes. The lowest level in the hierarchy is named logical_table_name Detail. For example, the lowest level of the periods table is Periods Detail.
The logical key of the dimension table is mapped to the lowest level of the hierarchy and specified as the level key. This logical column should map to the key column of the lowest level table in the dimension source.
If there are two or more physical tables in a source, the columns that map to the keys of those tables become additional logical levels. These additional level names use the logical column names of these key columns.
The order of joins determines the hierarchical arrangement of the logical levels. The level keys of these new logical levels are set to the logical columns that map to the keys of the tables in the source.
If there are multiple logical table sources, the tool uses attribute mappings and physical joins to determine the hierarchical order of the tables in the physical sources. For example, you might have three sources (A, B, C) each containing a single physical table and attribute mappings for 10, 15, and 3 attributes, respectively, not counting columns that are constructed from other logical columns. The following is a list of the results of creating a dimension for this table automatically:
The Administration Tool creates a dimension containing four logical levels, counting the Grand Total and detail levels.
The key of the table in source B, that has the greatest number of columns mapped and contains the column mapping for the logical table key, is the level key for the detail level.
The parent of the detail level is the logical level named for the logical column that maps to the key of the physical table in source A.
Any attributes that are mapped to both A and B should be associated with level A.
The parent of level A should be the logical level named for the logical column that maps to the key of the physical table in source C.
Any columns that are mapped to both A and C should be associated with level C.
Table joins in a physical source might represent a pattern that results in a split hierarchy. For example, the Product table can join to the Flavor table and a Subtype table. This would result in two parents of the product detail level, one flavor level and one subtype level.
You cannot create a dimension automatically in the following situations:
If a dimension with joins and levels has already been created, Create Dimension does not appear on the right-click menu.
If the table is not yet joined to any other table, the option is not available because it is considered a fact table.
In a snowflake schema, if you use a table with only one source and create the dimension automatically, the child tables are automatically incorporated into a hierarchy. The child tables form intermediate levels between the Grand Total level and detail level. If more than one child table exists for a dimension table, the hierarchy is a split hierarchy.
You can set up a dimension automatically from a logical dimension table if a dimension for that table does not exist.
To create a dimension automatically, the Administration Tool examines the logical table sources and the column mappings in those sources and uses the joins between physical tables in the logical table sources to determine logical levels and level keys. As a best practice, create a dimension table after all the logical table sources have been defined for a dimension table.
You can use Estimate Levels to automatically populate level counts for one or more dimension hierarchies.
Level counts are used by the query engine to determine the optimal query plan and to improve overall system performance.
You must open the repository in online mode and ensure that the business model is available for queries. In the Business Model and Mapping layer, you can select any of the following logical layer elements, and then execute the Estimate Levels command:
Business model. If you select the business model object, the Oracle BI Administration Tool attempts to check out all objects in the business model.
Dimension. Run a consistency check on dimensions to ensure that the dimension is logically sound.
A combination of business models and dimensions. You can select multiple dimensions and multiple business models individually.
When run, the Estimate Levels command also launches a consistency check on the level counts as described in the following list:
Checks that a level key is valid. Columns in levels have referential integrity.
Checks the parent-child relationship. If the parent level count is greater that the child level count, an error is returned.
Generates a run report that lists all the counts that were estimated and any errors or consistency warnings.
The queries and errors are logged to nqquery.log
when using an 11g version on the Oracle BI Server. When using Oracle BI EE 12c, the queries and errors are logged in the obis1_query.log
located in the DOMAIN_Home/servers/obis1/logs
.
Set the log level at 4 or higher to write this information to the log file. See Diagnosing and Resolving Issues in Oracle Business Intelligence in System Administrator's Guide for Oracle Business Intelligence Enterprise Edition.
When you check in the objects, you can check the global consistency of your repository.