【问题标题】:SSRS MDX - Display measure upto date in fiscal year, display all children in fiscal yearSSRS MDX - 显示会计年度的最新测量,显示会计年度的所有子项
【发布时间】:2012-09-14 11:32:51
【问题描述】:

使用这个脚本

SELECT  [Date].[Fiscal Year-Month].[Fiscal Year].&[2012/13].Children ON ROWS
        , [Measures].[Capacity] ON COLUMNS

FROM    [CubeName]

我得到以下结果:

        Capacity
Apr-12  81.07%
May-12  81.99%
Jun-12  82.29%
Jul-12  82.13%
Aug-12  82.47%
Sep-12  79.10%
Oct-12  (null)
Nov-12  (null)
Dec-12  (null)
Jan-13  (null)
Feb-13  (null)
Mar-13  (null)

我要做的是为截至 7 月底的职位生成一份月度报告,显示每个月的值,因此我希望将 8 月和 9 月排除在衡量标准之外,但我想保留从日期开始的月份报表布局的尺寸。最终结果应该是:

        Capacity
Apr-12  81.07%
May-12  81.99%
Jun-12  82.29%
Jul-12  82.13%
Aug-12  (null)
Sep-12  (null)
Oct-12  (null)
Nov-12  (null)
Dec-12  (null)
Jan-13  (null)
Feb-13  (null)
Mar-13  (null)

如何使用 MDX 实现这一目标? 然后,这将在 SSRS 2008 中的矩阵中使用。

【问题讨论】:

    标签: sql-server-2008 date reporting-services mdx


    【解决方案1】:

    使用这样的查询:

    WITH MEMBER [Measures].[Capacity2] AS IIf('[Date].[Fiscal Year-Month].CurrentMember is August or September', Null, [Measures].[Capacity])
    SELECT  [Date].[Fiscal Year-Month].[Fiscal Year].&[2012/13].Children ON ROWS,
    [Measures].[Capacity2] ON COLUMNS
    FROM [CubeName]
    

    你只需要在 IIf 中写下正确的条件。

    【讨论】:

    • 感谢您的解决方案。我正在尝试调整它以使用日期集而不是 IS 8 月或 9 月,尽管我不喜欢使用 EXISTS。然后我应该能够使用来自 SSRS 的参数。
    猜你喜欢
    • 2011-05-25
    • 1970-01-01
    • 2020-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-05
    相关资源
    最近更新 更多