OBiee 创建基于父子关系的层次

OBiee 创建基于父子关系的层次

 

前提条件

所需维表内必须有 Parent_id 字段(在数据库中外键自关联),限制在于每个 Child 只有一个直接 Parent .

所需关系表必须至少定义 Member Key Ancestor Key Distance IsLeaf 四个字段

可以让 AdminTool 帮助自动生成 SQL 脚本来建立并填充这个关系表 / 或者手动创建

 

若手动创建

每个 member 都要有一行指向自己, distance 0

每个 member 都必须指向其所有的 ancestors

 

每次改变数据后,填充脚本需要重新执行,原文如下

You must run the load script after each time the data changes in the dimension table. Because of this, you typically call the load script in your ETL processing. The load script reloads the entire parent-child relationship table; it is not incremental.

 

步骤

1. 需要建层次的维表全拖入逻辑层

2. 右击逻辑维表建立基于父子关系的层次

3. 选择父关键字( Parent_id

4. 选择父子关系表,选择创建,生成 SQL 脚本( Oracle/SqlServer 都可以)

5. 在数据库执行 SQL 脚本,生成并填充关系表

6. 导入生成的父子关系表,并且不要导入外键

7. 修改物理层的连接( D R Ancestor Key R F Member Key

8. 逻辑层维表的逻辑表源中将 R 表添加到映射表,可以把 Distance 字段拖入逻辑层当映射列

9. 逻辑表源的内容选项卡中,逻辑级别设置成详细,设置好父子关系选项卡

10. 拖入展示层完成模型,前台测试

11. 若报错未定义 4 列,在后台中更新该表的行计数再检入

 

 

具体模型的情况

1.Brand Product 两个表外键连接

D_Brand 做父子层次

所有层级的度量向上汇总

 

数据库中的连接


 

物理层

 

 

逻辑层

 

 

 

 

 

 

2. Entity , Currency 两个表

Entity 做父子层次

数据库中的连接


 

物理层

Currency 建立别名表

物理连接

手动删除 D 表和 R 表的连接,可以使层次中非叶级的层汇总上一级的数据


 

逻辑层


 

 

度量的三种汇总方式

1.       不汇总 ( As an attribute )

将度量放入维表,不设定汇总。

2.       全部向上汇总 (Full-Rollup)

如同模型 1

3.       Level0-up

 



 

 

 

 

猜你喜欢

转载自neednot.iteye.com/blog/1260416
今日推荐