简体   繁体   English

SQL SERVER SSAS:如何处理我的事实表中的NULL日期值,这样我可以处理我的时间维度而不会出错?

[英]SQL SERVER SSAS: How do I handle a NULL date value in my fact table, so I can process my time dimension without errors?

I have a fact table that has a column with dates loaded from an MS Access source. 我有一个事实表,其中包含一个从MS Access源加载日期的列。 The thing is, some of the values are NULL and the SSAS won't let me refer my DATE dimension to it. 问题是,某些值为NULL,SSAS不允许我将DATE维度引用给它。

Is it better to solve it at the SSIS stage or is there some solution at the SSAS? 在SSIS阶段解决它还是更好吗?还是SSAS有一些解决方案?

Thank you very much for you help. 非常感谢你的帮助。

Best practice is not to have any NULL key (ie Dimension key) values in a Fact table. 最佳做法是不在Fact表中包含任何NULL键(即Dimension键)值。

Instead, create a MAX date in the Date dimension table (or an 'UnknownValue', -1 for instance) and key to that. 而是在Date维表中创建一个MAX日期(或者'UnknownValue',例如-1)并键入该日期。

Sometimes it is undesirable for non-technical reasons to fix the nulls in the DSV or source system. 有时,出于非技术原因,不希望在DSV或源系统中修复空值。 In that case you can use the unknown member and null processing properties to work around this issue: 在这种情况下,您可以使用未知成员和空处理属性来解决此问题:

http://technet.microsoft.com/en-us/library/ms170707.aspx http://technet.microsoft.com/en-us/library/ms170707.aspx

I have done this when trying to highlight the data qualities problems or for fast prototyping purposes. 在尝试突出数据质量问题或快速原型设计时,我已经这样做了。

Each member of a hierarchy has a property "HideMemberIf". 层次结构的每个成员都具有属性“HideMemberIf”。 Setting this to "NoName", should hide the null values from the Dimension Browser and allow processing of the cube. 将其设置为“NoName”,应该隐藏Dimension Browser中的空值并允许处理多维数据集。

Also you could created Named Calculations in the Datamart View. 您还可以在Datamart视图中创建命名计算。 The Named Calculation would use the ISNULL function, which can fill in values in place of nulls. 命名计算将使用ISNULL函数,该函数可以填充值代替空值。 Then of course build your Time Dimension off of these Named Calculations instead of the raw data fields. 然后当然从这些命名计算而不是原始数据字段构建时间维度。

Again, it's better not to have any nulls in your data altogether, but you can usually fix this inside the Cube. 同样,最好不要在数据中使用任何空值,但通常可以在多维数据集中修复此值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SSAS:我的维度表可以包含事实表中没有的键吗? - SSAS: Can my Dimension Table contain keys that are not in the Fact Table? 如何使用SSAS事实表作为维 - How to use a SSAS fact table as a dimension 如何不计算SSAS中事实表的空值? - How to not count the null value from a fact table in SSAS? SQL Server如何更改视图,以便在插入表时不会产生重复? - SQL Server How do I change my view so it doesn't produces duplicates when inserting into a table? 如何处理错误,以便锁定的表将在过程中解锁? - How do I handle errors so a locked table will unlock in a procedure? 如何过滤具有维度的事实? - How can I filter Fact with a Dimension? 在 SQL Server 中创建临时表时,如何将日期更改为美国格式? - How do I change my date to US format when creating a staging table in SQL server? 如何根据此特定逻辑在我的日期维度表中创建周组列? - How can I create a week group column in my Date Dimension Table based on this specific logic? SSIS在我的事实表中查找多个日期,如何使用一个日期维度实现此目的? - SSIS Lookup multiple dates in my fact table, how to pull this off using one date dimension? 如何在SQL Server中获取日期时间差的值 - How can I get the value of the date time difference in SQL Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM