SSAS 和 2 类 SCD 数据

SSAS and Type 2 SCD Data

我无法使用 SSAS 和 Type 2 SCD 数据获得预期结果。下面,我列出了我正在使用的简单 tables、我得到的 SSAS 输出以及我希望的 SSAS 输出。我觉得 SSAS 应该能够像我想要的那样检索数据;我相信我只是很难正确 "hooking it up" :)。

我正在使用的表格

DimClient
ID (PK)     AltID (Business Key)     Name        Start Date     End Date
1           1                        Client A    01/01/1995     01/31/1995
2           1                        Client ABC  02/01/1995     NULL

FactSales
ID (PK)     ClientID    Sales     SalesDate
1           1           0      01/15/1995
2           1           0      02/15/1995
3           1           0      03/15/1995

加上一个 DimDate table,其中每个日期从 01/01/1900 -> 12/31/2050 输入为 PK,加上它们的各种属性,如星期几、星期几等。 .等..

输出(当前与预期)

我试图按月查看客户数据,我得到了:

Month       Client      Sales
January     Client A    0
February    Client A    0
March       Client A    0

当我期待(并且想要)看到这个时:

Month       Client      Sales
January     Client A    0
February    Client ABC  0
March       Client ABC  0

为什么我的 SSAS 多维数据集无法识别在 2 月和 3 月将客户端 A 更改为客户端 ABC?

希望对我的多维数据集当前的连接方式提供一些见解:

-FactSales ClientID linked 到 DimClient AltID
-FactSales SalesDate linked 到我的 DimDate PK 字段

我无法通过任何方式link DimClient 到 DimDate。

感谢您的意见和帮助解决我的问题!

您需要为 linking FactSales 和 DimClient 使用另一个密钥。

它是 DimClient 的 ID 和下面描述的新密钥。

然后向 FactSales 添加另一个密钥(假设为 ClientSCD)并将其映射到 ETL 阶段,如下所示:

update f set f.ClientSCD = isnull(c.ID,0)
/* if you have default NONE member with ID = 0 */
FactSales f
left join DimClient c
on f.ClientID = c.AltID
and f.SalesDate between c.[Start Date] and isnull(c.[End Date],'12/31/9999')

在你的多维数据集中使用 DimClient.ID 和 FactSales.ClientSCD 作为 link。