SSIS MDX 查询问题

发布于 2024-11-25 14:36:01 字数 1821 浏览 1 评论 0原文

哈喽!

我在 MDX 中的查询有一点问题。

我尝试从我的多维数据集中查询损坏修复类型。接下来我解释一下我的维度和事实表:

维度:损坏修复类型

RepairTypeKey |名称 | RepairTypeAlternateKey | 修复类型备用密钥RepairSubTypeAlternateKey | 修复子类型备用键子名
0 |未知 |0 | NULL | NULL
1 |维修 |1 |1 | 1 煮沸
2 |替换 |2 |NULL | NULL
3 |维修 |1 |2 | 2 疖子
4 |维修 |1 |3 | 3 疖子

因此,我的事实表“CLaimCosts”中为每个索赔提供了一个 RepairTypeKey。我填写表格并设计一个立方体。维度具有包含 RepairType 和 SubRepairType 的等级结构。我处理了立方体,效果很好:

  • 损坏修复类型
    • 等级制度
      • 成员
        • 全部
          • 更换
          • 修复
            • 1 煮沸
            • 2 次煮沸
            • 3 次煮沸
          • 未知

现在我使用 MDX 创建查询:

select
    {
        [Measures].[Claim Count],
        [Measures].[Claim Cost Position Count],
        [Measures].[Claim Cost Original],
        [Measures].[Claim Cost Original Average],
        [Measures].[Claim Cost Possible Savings],
        [Measures].[Claim Cost Possible Savings Average],
        [Measures].[Claim Cost Possible Savings Percentage] 
    } on 0,

    NON EMPTY{
        NonEmpty([Damage Repair Type].[Hierarchy].Allmembers, ([Measures].[Claim Count]))
    } on 1

    from 
        Cube

    where 
    (
        ({StrToMember(@DateFrom) : StrToMember(@DateTo)})
        ,([Claim Document Type].[Document Type].&[4])


    )

现在我尝试运行查询,它可以工作,但我显示了很多行:

Demage Repair Type |损坏修复子类型 |索赔计数 | ....
NULL |NULL | 200000
更换| NULL | 150000
维修| NULL | 45000
维修| 1 煮沸| 10000
维修| 2 煮沸| 15000
维修| 3 煮沸| 19000
未知 |NULL | 1000

我的问题是第一行(总和)和第三行(总和)!我不需要这些行,但我不知道如何过滤它们!我不需要这个总和,因为我有正确计数的孩子!

我如何过滤这个?请帮我。这不起作用!

抱歉我的英语不好,谢谢!

亚历克斯

Hallo at all!

I have a little Problem with my Query in MDX.

I try to query up the Damage Repair Types from my Cube. Next i explain my Dimension and the Fact Table:

Dimension: Demage Repair Type

RepairTypeKey | Name | RepairTypeAlternateKey | RepairSubTypeAlternateKey | SubName
0 |Unknown |0 | NULL | NULL
1 |Repair |1 |1 | 1 Boil
2 |Replacement |2 |NULL | NULL
3 |Repair |1 |2 | 2 Boils
4 |Repair |1 |3 | 3 Boils

So I have in my Fact Table "CLaimCosts" for every Claim one RepairTypeKey. I Fill the Tables and design a Cube. The Dimension have a Hirarchy with RepairType and SubRepairType. I Process the Cube and it works Fine:

  • Demage Repair Type
    • Hirarchy
      • Members
        • All
          • Replacement
          • Repair
            • 1 Boil
            • 2 Boils
            • 3 Boils
          • Unknown

Now I Create a Query with MDX:

select
    {
        [Measures].[Claim Count],
        [Measures].[Claim Cost Position Count],
        [Measures].[Claim Cost Original],
        [Measures].[Claim Cost Original Average],
        [Measures].[Claim Cost Possible Savings],
        [Measures].[Claim Cost Possible Savings Average],
        [Measures].[Claim Cost Possible Savings Percentage] 
    } on 0,

    NON EMPTY{
        NonEmpty([Damage Repair Type].[Hierarchy].Allmembers, ([Measures].[Claim Count]))
    } on 1

    from 
        Cube

    where 
    (
        ({StrToMember(@DateFrom) : StrToMember(@DateTo)})
        ,([Claim Document Type].[Document Type].&[4])


    )

Now i try to Run the Query and it Works but i have to much Rows Shown:

Demage Repair Type | Demage Repair Sub Type | Claim Count | ....
NULL |NULL | 200000
Replacement | NULL | 150000
Repair | NULL | 45000
Repair | 1 Boil | 10000
Repair | 2 Boil | 15000
Repair | 3 Boil | 19000
Unknown |NULL | 1000

My Problem are the frist Row (Sum) and the third Row (Sum)! I don't need this Rows but I don't know how to Filter them! I don't need this Sums because i have the Childs with the right Counts!

How I can Filter this? Please help me. It doesn't work!

Sorry for my bad English and Thank you!

Alex

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

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

发布评论

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

评论(1

我的奇迹 2024-12-02 14:36:01
NonEmpty([Damage Repair Type].[Hierarchy].Allmembers, ([Measures].[Claim Count]))

您可以使用:

NonEmpty([Damage Repair Type].[Hierarchy].Levels(2).Members, [Measures].[Claim Count])

这样我们就排除了所有成员。另外,当您使用级别成员(例如 [dim].[hier].[lvl].Members)而不是层次结构成员(例如 [dim].[hier].members)时,您不会获得聚合成员 -例如,All 成员通常存在于除不可聚合属性层次结构之外的所有层次结构中。

NonEmpty([Damage Repair Type].[Hierarchy].Allmembers, ([Measures].[Claim Count]))

You can use:

NonEmpty([Damage Repair Type].[Hierarchy].Levels(2).Members, [Measures].[Claim Count])

This way we exclude the All members. Also, when you use the level members (e.g. [dim].[hier].[lvl].Members) instead of the hierarchy members (e.g. [dim].[hier].members) you don't get the aggregate members - e.g. the All member which is commonly present in all hierarchies other than non-aggregatable attribute hierarchies.

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