1

我对 MDX 和 SSAS 相当陌生。最近,我被要求生成一份报告,该报告需要每个月的起始值,然后每个周期内的变动以下个月的起始值结束。

我可以在两个单独的 MDX 中生成这个,见下文,但我很困惑如何将这些结果放在 SSRS 的一个数据集中,而无需基本上在数据库中物理形成数据并将低谷拉入仓库。查询略有不同,因为它们都使用不同的 Measure,然后使用几个 Dimensional 过滤器。

任何帮助将不胜感激,我希望这里有人可以提供帮助或提供一些有用的建议,以其他方式可能达到我需要的目的:

    WITH MEMBER [Member1] AS AGGREGATE( ({[SRD Date].[Base Report Date].& [1]},{[SRD Date].[Current Year].& [Yes]}),  [Measures].[Amount])
SELECT NON EMPTY {  [member1]  } ON COLUMNS
    , NON EMPTY {([SRD Date].[Year].[Year].ALLMEMBERS
     * [SRD Date].[Month Key].[Month Key].ALLMEMBERS
      * [SRD Date].[Month Of Year].[Month Of Year].ALLMEMBERS) } DIMENSION PROPERTIES MEMBER_CAPTION
    , MEMBER_UNIQUE_NAME ON ROWS FROM (
        SELECT (
                - { [Resource].[Category].& [Support]
                , [Resource].[Category].& [Bolt-on] }
                ) ON COLUMNS
        FROM (
                SELECT ([Exclude Test Accounts]) ON COLUMNS
                FROM (
                    SELECT ([OnlyUnitsAndItems]) ON COLUMNS
                    FROM (
                        SELECT ([ExcludeNonReportableMonths]) ON COLUMNS
                        FROM [Cube1]
) ) ) ) 



WITH MEMBER [Member2] AS AGGREGATE( ( {[SRD Date].[Current Year].& [Yes]}),  [Measures].[Amount Of Movement])
SELECT NON EMPTY {  [Member2]   } ON COLUMNS
    , NON EMPTY {([SRD Date].[Year].[Year].ALLMEMBERS
     * [SRD Date].[Month Key].[Month Key].ALLMEMBERS
      * [SRD Date].[Month Of Year].[Month Of Year].ALLMEMBERS
       * [SRD].[Movement Type].[Movement Type].ALLMEMBERS) } DIMENSION PROPERTIES MEMBER_CAPTION
    , MEMBER_UNIQUE_NAME ON ROWS FROM (
        SELECT (
                - { [Resource].[Category].& [Support]
                , [Resource].[Category].& [Bolt-on] }
                ) ON COLUMNS
        FROM (
                SELECT ([Exclude Test Accounts]) ON COLUMNS
                FROM (
                    SELECT ([OnlyUnitsAndItems]) ON COLUMNS
                    FROM (
                        SELECT ([ExcludeNonReportableMonths]) ON COLUMNS
                        FROM [Cube1]
) ) ) ) 
4

1 回答 1

1

只需结合两个 WITH 子句(中间没有逗号或任何内容!),并在列轴中列出两个成员:

WITH MEMBER MEMBER [Member1] AS AGGREGATE( ({[SRD Date].[Base Report Date].& [1]},{[SRD Date].[Current Year].& [Yes]}),  [Measures].[Amount])
            MEMBER [Member2] AS AGGREGATE( ( {[SRD Date].[Current Year].& [Yes]}),  [Measures].[Amount Of Movement])
SELECT NON EMPTY {  [Member1], [Member2]   } ON COLUMNS
    , NON EMPTY {([SRD Date].[Year].[Year].ALLMEMBERS
     * [SRD Date].[Month Key].[Month Key].ALLMEMBERS
      * [SRD Date].[Month Of Year].[Month Of Year].ALLMEMBERS
       * [SRD].[Movement Type].[Movement Type].ALLMEMBERS) } DIMENSION PROPERTIES MEMBER_CAPTION
    , MEMBER_UNIQUE_NAME ON ROWS FROM (
        SELECT (
                - { [Resource].[Category].& [Support]
                , [Resource].[Category].& [Bolt-on] }
                ) ON COLUMNS
        FROM (
                SELECT ([Exclude Test Accounts]) ON COLUMNS
                FROM (
                    SELECT ([OnlyUnitsAndItems]) ON COLUMNS
                    FROM (
                        SELECT ([ExcludeNonReportableMonths]) ON COLUMNS
                        FROM [Cube1]
) ) ) ) 

我希望我没有错过两个查询之间的任何重要的其他区别。

于 2013-08-19T17:28:28.183 回答