Use Case 7: Create Custom Dim with Hierarchy
You can create a dimension with a hierarchy by defining a parent-child level-based hierarchical structure.
The prebuilt SCM – Sales Order subject area doesn’t contain the required Dim – Party Hierarchy Dim dimension attributes and hierarchical levels. In this use case, you add a folder Dim - Party Hierarchy Dim to the SCM – Sales Orders prebuilt subject area. This folder contains the Accounts Level Hierarchy hierarchy with four levels, plus a detailed lowest level. The custom dimension with hierarchy is joined to the prebuilt Fact – OM Sales Orders fact using the Party ID key.
This use case requires Fusion SCM Analytics subscription. However, you can apply the concepts covered in this use case to any other Fusion Data Intelligence subscription. The use case may reference Autonomous Data Warehouse prebuilt tables and synonyms and mock custom database tables and views. If you’ve activated the specified Fusion Data Intelligence subscription, you may use the samples provided. The recommendation is to substitute the sample objects for your own custom Autonomous Data Warehouse objects such as custom table, materialized view, view, custom synonym, or data augmentation dataset synonym.
- Prebuilt Subject area: SCM – Sales Orders
- Create a sandbox titled MySandbox5Mar25. See Create Sandbox. Or, edit an existing sandbox on the Semantic Model Extensions page; for example, by clicking the MySandbox5Mar25 sandbox.
- Generate the sample dimension view FDI_X_PARTY_HIERARCHY_D_V using this SQL
script:
CREATE OR REPLACE FORCE EDITIONABLE VIEW "OAX_USER"."FDI_X_PARTY_HIERARCHY_D_V" ("PARTY_ID", "LVL1", "LVL2", "LVL3", "LVL4", "LVL_DETAIL") DEFAULT COLLATION "USING_NLS_COMP" AS ( SELECT DISTINCT PARTY_ID, NVL(COUNTRY,'~No Value~') as LVL1, NVL(STATE,'~No Value~') as LVL2, NVL(CITY,'~No Value~') as LVL3, NVL(POSTAL_CODE,'~No Value~') as LVL4, NVL(PARTY_NAME,'~No Value~') as LVL_DETAIL FROM OAX$OAC.DW_PARTY_D where (CUSTOMER_FLAG <> 'N' or CUSTOMER_FLAG is null) );
- Grant semantic model access to the FDI_X_PARTY_HIERARCHY_D_V view for the
OAX$OAC schema using the following SQL
script:
GRANT SELECT ON "OAX_USER"."FDI_X_PARTY_HIERARCHY_D_V" TO "OAX$OAC";
- Validate that the data is loading from the sample as expected using the
following SQL
script:
SELECT * FROM OAX_USER.FDI_X_PARTY_HIERARCHY_D_V;
- Confirm that the foreign key is unique to avoid inaccurate results caused from
possible duplication due to incorrect granularity by entering this SQL script
under SQL Worksheet on the right pane in SQL Developer
Client:
SELECT PARTY_ID, COUNT(*) FROM FDI_X_PARTY_HIERARCHY_D_V GROUP BY PARTY_ID HAVING COUNT(*) > 1;
Add Custom Fact to the Semantic Model
You edit the logical star to define the autonomous data warehouse objects, attributes, display labels, keys, and hierarchy.
Add Physical Column to a Prebuilt Fact to Expose Foreign Key to Join On
You extend the prebuilt fact to expose physical columns that will be used as keys to join the new custom dimension in the logical star. You must give the logical columns unique names.
Join the Custom Dimension Hierarchy to a Prebuilt Fact
You join the custom dimension hierarchy to the prebuilt fact by defining the join type, join condition, and context level. You can define complex joins; however, it's advised to try and use standard joins where possible.
Present the Custom Dimension Hierarchy in the Semantic Model
You modify the subject area to present the new custom dimension attributes and hierarchy levels.
The system represents the dimension as a folder containing columns in the subject area and represents the hierarchy levels at the bottom of the custom dimension folder. Hierarchy levels used in Workbooks can expand and collapse to reveal or hide detailed rows.
In this step, you modify the SCM – Sales Order subject area to present the new custom Dim – Party Hierarchy Dim folder containing the custom hierarchy Accounts Level Hierarchy with four levels (Level 1, Level 2, Level 3, Level 4) and the lowest Detailed level.
Apply and Publish the Customizations
You apply the changes to compile the sandbox and ensure that the sandbox is error free.
Then, you use the Activity tab to debug, resolve errors, and confirm that the Apply Changes action completes and is successful. Finally, you merge the changes to the main sandbox and publish the main user extensions to share the new extensions with consumers.
In this step, you apply the changes, use the Activity tab to monitor the status, merge the MySandbox5Mar25 sandbox to the Main sandbox, and then publish the main user extension.