非时间维度中最后一个子级的计算成员?
在 SSAS 多维数据集中,如何为非时间维度创建聚合为 LastChild 的度量?
源数据在任何一天都有相同业务记录的多个版本。时间维度的粒度是 DATE,而不是秒和秒。毫秒。
事实记录具有时间戳和增量(身份)主键。实际上,我想要的是将度量计算为给定日期所有编辑的最后一个值。
到目前为止,我看到的选项属于以下两类之一:
- 生成精确到秒的时间维度。这将导致非常大且低效的时间维度。
或者
- 隐藏度量并将其替换为计算度量,这些度量根据主键查找任何给定日期的最后一个值。这样既麻烦又效率低。
是否有最佳点或替代技术来解决这个问题?
数据的自然层次结构是:
- 业务键
- 记录时间戳(链接到时间维度)
- 代理键
In a SSAS cube, how do I create measures that are aggregated as LastChild for a non-time dimension?
The source data has many versions of the same business record on any given day. The time dimension has a granularity of DATE, not seconds & milliseconds.
The fact records have a timestamp and an incremental (identity) primary key. In effect, what I want is to calculate a measure as being the last value for all edits on a given date.
The options I've seen so far fall into one of two categories:
- Produce a time dimension that goes down to seconds. This would result in a very large and inefficient time dimension.
OR
- Hide the measures and replace them with calculated measures that look up the last value for any given date based on the primary key. This is cumbersome and less efficient.
Is there a sweet spot or alternative technique to solve this problem?
The natural hierarchy of the data is:
- Business Key
- Record Timestamp (links to TIME dimension)
- Surrogate Key
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,您绝对无法创建没有时间维度的 latChild 属性:
您可以做的是创建查询在 DSV 上为您提供最后一个子值并使用它来创建度量值组。示例:
脚本:
非常简单的脚本,用于创建暗淡表和事实表。这是一个简单的选择,在我认为你想要的结果之后,因此 3 和 20 将是基于维度 ID 的最后一个值:
构建非常简单,只需右键单击您的 DSV 并添加一个新的命名查询并通知查询创建您的最后一个值。在我的例子中是:
创建一个逻辑主键并将其链接到维度表:

在您的多维数据集中,右键单击任意空白区域,选择“显示所有表格”并添加新表格。
在您的多维数据集中创建一个新度量作为“无聚合”,因为您已经聚合了查询:
结果:
No, you absolutely cant create a latChild attribute without a time dimension:
what you can do is create a query on your DSV to give you the last child value and use it to create a measure group. Example:
Script:
very simple script that creates a dim and a fact table. Here is a simple select and after the result I think you want, so 3 and 20 would be the last values based on the Dimension's ID:
to build that is very simple, just right click on your DSV and add a new named query and inform the query to create your last value. In my case is:
create a logical primary key and link it to the dimension table:

and on your cube, right click any blank area, select "show all tables" and add your new table.
And on your cube create a new measure as "no aggregations" because you have already aggregated your query:
Result: