# Defining a New Cube - OLAP

Cubes provide a method of organizing measures with similar characteristics. There is no practical limit on the number of measures that you can associate with a particular cube. However, you may prefer to create a separate cube for some calculated measures, even though they have the same characteristics as an existing cube. For example, while you can add forecast measures to an existing cube with actual measures, you might not want to risk confusing them.

The metadata for cubes includes information about the source variables for its measures, such as the names of the composite and the aggregation maps. The following discussion assumes that these objects already exist.

Creating a Cubedef Object

A cubedef object is a text dimension that lists the names of a cube's dimensions, as described in "Standard Form Cubes"Take the following steps to create a cubedef object using Analytic Workspace Manager.

1. Open the Object View and expand the folder for your analytic workspace.
2. Expand the Dimension folder and right-click a cubedef dimension for an existing cube.
3. Choose Create Like from the menu.
The Create Like dialog is displayed.
4. Type a name for the new cube.
To conform with the other cube names in the workspace, the name should end with _CUBE, such as SALES_CUBE.
5. Select the new cubedef dimension from the Dimension folder, and make these changes in the property viewer:
• Basic page: Type a new description.
• Properties page: Delete these properties: AW$LOADPRGS, LOAD_TYPE, SOURCE_NAME, SOURCE_OWNER. Then edit the other property values so they are appropriate for the new object. For more information about these properties, The new cube does not use a load program to obtain data, and it should not appear in the Refresh wizard. 6. Open OLAP Worksheet. Use commands such as the following to add the names of dimensions as values: MAINTAIN cube ADD 'dimension' 'dimension' ... For example: MAINTAIN new_cube ADD 'PRODUCT' 'TIME' 7. From the File menu, choose Save to update the analytic workspace and all objects in the current schema. Creating a Default Aggregation Map All cubes must have a default aggregation map, which is used initially to guarantee that all queries are answered by fully solved measures. An aggregation map (or aggmap object in the language of the OLAP DML) containsall of the rules for aggregation. To create a default aggregation map for a cube, take these steps: 1. In the Object View, expand the Aggregation Maps folder. 2. Right-click the default aggregation for a similar cube and choose Create Like from the menu. A default aggregation map has a name such as UNITS_CUBE_AGGMAP_AWCREATEDDEFAULT_1. 3. Give the new aggregation map a similar name, such as FORECAST_CUBE_AGGMAP_AWCREATEDDEFAULT_1. 4. Select the new aggregation map and make these changes: • Properties page: Change the value of AW$PARENT_NAME to the name of the new cube.
• Aggmap page: Verify that there is exactly one RELATION command for each dimension of the new cube. If changes are needed, make them and then click Compile to check the syntax of your changes.
5. Click Apply to save these changes in your session.
6. From the File menu, choose Save to save these changes for future sessions.

Registering a New Cube

Registering a cube is very similar to registering a measure, as described in "Registering a New Measure" . It involves most of the same catalogs. You can examine their property sheets in Analytic Workspace Manager, or you can issue this command in OLAP Worksheet to see their definitions:

DESCRIBE all_cubes all_descriptions aw_names cube_measures

Adding a Cube to the ALL_CUBES Dimension

The ALL_CUBES dimension is a list of all cubes in the analytic workspace. To see its contents, issue this OLAP DML command:

REPORT W 40 all_cubes

The names of the cubes have this detailed format:

schema.cube.CUBE

To add a new cube to ALL_CUBES, use this command syntax:

For example:

Issue another REPORT command to make sure that the change was made correctly, then issue these commands to save it:

UPDATE; COMMIT

Adding a Cube to the ALL_DESCRIPTIONS Variable

The ALL_DESCRIPTIONS variable stores the short, long, and plural descriptions of each object, as described in "ALL_DESCRIPTIONS Variable".

Use commands such as these to add descriptions of your new cube:

Issue another REPORT command to make sure that the change was made correctly, then issue these commands to save it:

UPDATE; COMMIT

Adding a Cube to the AW_NAMES Variable

The AW_NAMES variable identifies the full name of objects in the analytic workspace, as described in "AW_NAMES Variable" . Use commands such as these to add the workspace name of a new cube:

Issue another REPORT command to make sure that the changes were made correctly, then issue these commands to save them:

UPDATE; COMMIT

Adding Measures to the New Cube in the CUBE_MEASURES Valueset

The CUBE_MEASURES valueset identifies the measures in each cube, as described in "CUBE_MEASURES Valueset".
Use commands such as these to add measures to the new cube:

For example:

Issue another REPORT command to make sure that the changes were made correctly, then issue these commands to save them:

UPDATE; COMMIT

Troubleshooting a Hand-Crafted Cube

If you made errors in creating a cube, then errors will occur when you try to aggregate the cube, or refresh or enable your analytic workspace. Follow this check list to identify the cause of failure.

• Check the properties of the cube dimension against those listed in "Standard Form Cubes". If you copied another cube, make sure that you made all of the appropriate changes to the property values.
• Verify that you populated the cube dimension.
• Verify that you added the cube to the ALL_CUBES dimension.
• Verify that you added the cube to the AW_NAMES variable.