0
votes

I have a MDX-Query that is structured like this:
1st column: Plan Costs, Year: 2015, Month January - December
2nd column: Actual Costs, Year: 2015, Month January
3rd column: Actual Costs, Year: 2015, Month February

SELECT {   
([YEAR].[2015], [MONTH].[ALL],[TYPE].[PLAN])  
([YEAR].[2015], [MONTH].[1],  [TYPE].[ACTUAL])   
([YEAR].[2015], [MONTH].[2],  [TYPE].[ACTUAL])}     
ON COLUMNS,
{[xxx].[xxx]} ON ROWS
FROM [CUBE]
WHERE [MEASURES].[COSTS]

Above MDX-Code works fine. Now I want to add a 4th column to the Query that returns:
4th column: Actual Costs, Year: 2015, Month Janury - February.
How can I achieve this in MDX?

More or less it should look like this...

SELECT {    
([YEAR].[2015], [MONTH].[ALL], [TYPE].[PLAN])  
([YEAR].[2015], [MONTH].[1],   [TYPE].[ACTUAL])     
([YEAR].[2015], [MONTH].[2],   [TYPE].[ACTUAL])  
([YEAR].[2015], [MONTH].[1-2], [TYPE].[ACTUAL]) ???  
}
ON COLUMNS,
{[xxx].[xxx]} ON ROWS
FROM [CUBE]
WHERE [MEASURES].[COSTS]
1

1 Answers

0
votes

I think maybe an aggregation of the two months in the WITH clause should suffice:

WITH MEMBER [MONTH].[1-2] AS
AGGREGATE(
  {
   [MONTH].[1]
  ,[MONTH].[2]
  }
)
SELECT 
NON EMPTY
  {    
    ([YEAR].[2015], [MONTH].[ALL], [TYPE].[PLAN])  
    ([YEAR].[2015], [MONTH].[1],   [TYPE].[ACTUAL])     
    ([YEAR].[2015], [MONTH].[2],   [TYPE].[ACTUAL])  
    ([YEAR].[2015], [MONTH].[1-2], [TYPE].[ACTUAL]) 
  }
ON COLUMNS,
NON EMPTY
  {[xxx].[xxx]} ON ROWS
FROM [CUBE]
WHERE [MEASURES].[COSTS];