包含“总计”的度量名称在立方体中有奇怪的总计计算

发布于 2024-10-17 18:28:26 字数 889 浏览 6 评论 0原文

在使用 AMO 以编程方式为 SQL Server Analysis Services 构建多维数据集时,我发现当度量的标题中包含“总计”时,多维数据集中的总计是通过不同的总和而不是仅通过总和来计算的(创建非常奇怪的结果) )

使用 DSO 构建多维数据集时不会发生这种情况。有谁知道为什么会发生这种情况?

请原谅我使用 python:

class MeasureSpec(MeasureSpec):
    def create(self, measureGroup, cube, dsv, factTable):
        log("creating measure:", self.name)
        measure = measureGroup.Measures.Add(self.name)
        measure.AggregateFunction = self.aggregateFunction
        measure.FormatString = self.format
        # Set datatype to integer for counts otherwise this is set to the same
        # type as the source column in createDataItem
        if self.aggregateFunction in (aggCount, aggDistinctCount):
            measure.DataType = MeasureDataType.Integer
        measure.Visible = self.isVisible
        measure.Source = createDataItem(dsv, factTable, self.column.getColumnName())

In programmatically building cubes for SQL Server Analysis Services using AMO, I've discovered that when a measure has "Total" in it's title, the grand total in the cube is calculated by a distinct sum instead of just a sum (creating very strange results)

This doesn't occur when building cubes using DSO. Does anyone know of why this could be happening?

Please pardon my use of python:

class MeasureSpec(MeasureSpec):
    def create(self, measureGroup, cube, dsv, factTable):
        log("creating measure:", self.name)
        measure = measureGroup.Measures.Add(self.name)
        measure.AggregateFunction = self.aggregateFunction
        measure.FormatString = self.format
        # Set datatype to integer for counts otherwise this is set to the same
        # type as the source column in createDataItem
        if self.aggregateFunction in (aggCount, aggDistinctCount):
            measure.DataType = MeasureDataType.Integer
        measure.Visible = self.isVisible
        measure.Source = createDataItem(dsv, factTable, self.column.getColumnName())

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小猫一只 2024-10-24 18:28:26

事情是这样的。 AMO 将数据列标记为名称中包含 Total 的任何内容的字节。它循环到 32,令人惊讶的是,这个数字与列上的不同总和相同......哇。

Here's what was going on. AMO was tagging the datacolumn as byte for anything with Total in the name. It was cycling to 32 which amazingly was the same number as a distinct sum on the column... Wow.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文