简体   繁体   English

SSAS 日期存储为文本

[英]SSAS Date stored as text

I have a measure table for forecast that has a MMM-YY date stored as text;我有一个预测的度量表,其中 MMM-YY 日期存储为文本;

Period Forecast
-------------------
Jan-20 200
Feb-20 300

I also have some other tables in my model that have similar date formats ie.我的 model 中还有其他一些具有类似日期格式的表,即。 (1/2020) or 2020_1. (1/2020)或 2020_1。 Hence I created a date dimension that maps the period to an actual datetime and linked it to the fact table;因此,我创建了一个将时间段映射到实际日期时间的日期维度,并将其链接到事实表;

Period (Month/Year) Year_Month MonthEnd
---------------------------------------------------
Jan-20 (1/2020) 2020_1 31/01/2020
Feb-20 (2/2020) 2020_2 28/02/2020

This is causing me two issues;这给我带来了两个问题;

  1. If I slice the forecast by period I get the right answer, but if I slice by the datetime field 'MonthEnd', SSAS can't allocate the costs across the attributes and I get the total each month (so 500 in both jan and feb in this example).如果我按时段划分预测,我会得到正确的答案,但如果我按日期时间字段“MonthEnd”划分,SSAS 无法跨属性分配成本,我每个月都会得到总计(所以 1 月和 2 月都是 500在这个例子中)。 Why?为什么?

  2. I can't connect time as a referenced dimension to the date dimension so I can't use any time intelligence features.我无法将时间作为参考维度连接到日期维度,因此我无法使用任何时间智能功能。

I could just swap the period ID for a datetime on ETL to standardise the date fields across the model, but I wondered if there was a standard way to approach this?我可以将 ETL 上的时间段 ID 换成日期时间,以标准化 model 中的日期字段,但我想知道是否有标准的方法来解决这个问题?

立方体

https://imgur.com/gallery/onxtvhq https://imgur.com/gallery/onxtvhq

In Analysis Services Multidimensional models you need to standardize on one format for representing a period and have all measure groups use that.在 Analysis Services 多维模型中,您需要标准化一种格式来表示一个时期,并让所有度量值组都使用它。 I would recommend you change the SQL Query for your Actuals measure group to return values that join to the Period column in your Date table.我建议您更改实际值度量组的 SQL 查询,以返回连接到日期表中的期间列的值。

Understanding how this works means understanding attribute relationships and the IgnoreUnrelatedDimensions setting.了解其工作原理意味着了解属性关系和IgnoreUnrelatedDimensions设置。 If set to true then slicing by an “unrelated” attribute (one that's below the grain or unrelated or an unrelated dimension) will just cause the measure to repeat.如果设置为 true,则按“不相关”属性(低于粒度或不相关或不相关维度的属性)进行切片只会导致测量重复。 If set to false then it will become null.如果设置为 false,那么它将变为 null。

I'm unclear why you need Time as a reference dimension.我不清楚你为什么需要时间作为参考维度。 It appears to also contain a Date hierarchy.它似乎还包含一个日期层次结构。 Typically Date is for days, weeks, months and years.通常日期是几天、几周、几个月和几年。 Typically Time is for hours minutes and seconds.通常时间是小时分钟和秒。 For processing performance reasons I would avoid reference dimensions.出于处理性能的原因,我会避免参考尺寸。 They are more trouble than they are worth.他们的麻烦多于他们的价值。 Add the Time dimension key to your fact tables.将时间维度键添加到事实表。

The scrrenshot shows there is relation between Date and Forcast,so I do not think the root cause that is the root casue,however, you can try GreGalloway's solution, to set the property of IgnoreUnrelatedDimensions to False to test. scrrenshot 显示 Date 和 Forcast 之间存在关系,所以我认为根本原因不是根本原因,但是,您可以尝试 GreGalloway 的解决方案,将 IgnoreUnrelatedDimensions 的属性设置为 False 进行测试。 enter image description here在此处输入图像描述

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM