我是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]
) ) ) )
答案 0 :(得分: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]
) ) ) )
我希望我不会错过两个查询之间的任何重要的其他差异。