1

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

我正在使用的表

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           $100      01/15/1995
2           1           $200      02/15/1995
3           1           $300      03/15/1995

加上一个 DimDate 表,其中包含从 01/01/1900 -> 12/31/2050 输入的每个日期作为 PK,以及它们的各种属性,如月份中的日期、星期几等。等等。

输出(当前与预期)

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

Month       Client      Sales
January     Client A    $100
February    Client A    $200
March       Client A    $300

当我期待(并希望)看到这个时:

Month       Client      Sales
January     Client A    $100
February    Client ABC  $200
March       Client ABC  $300

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

希望对我的立方体当前是如何连接的提供一些见解:

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

我无法以任何方式将 DimClient 链接到 DimDate。

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

4

1 回答 1

1

您需要使用另一个键来链接 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 作为链接。

于 2015-01-12T08:06:42.643 回答