stangeljl18
Programmer
I run this query in the MDXSample application...
I use to date range sets and crossjoin to get them back in the result.
WITH
SET ["2001"] As ' {[Date].[2001].[Quarter 1].[January].[1]:[date].[2001].[Quarter 4].[December].[31]}'
member [Date].["2001"]
as 'Aggregate(["2001"])'
SET ["2000"] As ' {[Date].[2000].[Quarter 1].[January].[1]:[date].[2000].[Quarter 4].[December].[29]}'
member [Date].["2000"]
as 'Aggregate(["2000"])'
SELECT {[Measures].[Sales],[Measures].[Margin]}
ON COLUMNS ,
CrossJoin ({[Date].["2000"],[Date].["2001"]},[Catalog Section].[Group].members) ON ROWS
FROM [Invoice] where ([Contract].[Contract].&[AC], [Invoice Category].&[P])
The result is this...
"2000" - Section 1 - $ - $
- Section 2 - $ - $
"2001" - Section 1 - $ - $
- Section 2 - $ - $
We use Queries through Query Ananlyzer and stored Procs so we commonly wrap them in OPENQUERY like the Following:
SELECT * FROM
OPENQUERY(cpmarketing,
'WITH
SET ["2001"] As '' {[Date].[2001].[Quarter 1].[January].[1]:[date].[2001].[Quarter 4].[December].[31]}''
member [Date].["2001"]
as ''Aggregate(["2001"])''
SET ["2000"] As '' {[Date].[2000].[Quarter 1].[January].[1]:[date].[2000].[Quarter 4].[December].[29]}''
member [Date].["2000"]
as ''Aggregate(["2000"])''
SELECT {[Measures].[Sales],[Measures].[Margin]}
ON Columns ,
CrossJoin ({[Date].["2001"],[Date].["2000"]},[Catalog Section].[Group].members) ON Rows
FROM [Invoice] where ([Contract].[Contract].&[AC], [Invoice Category].&[P])')
This returns the following:
Section 1 - $ - $
Section 2 - $ - $
Section 1 - $ - $
Section 2 - $ - $
There is no distinction of the date ranges anymore...
Any ideas on how to get them into the result set so it
returns like
"2000" - Section 1 - $ - $
"2000" - Section 2 - $ - $
"2001" - Section 1 - $ - $
"2001" - Section 2 - $ - $
Thanks For Any help
I use to date range sets and crossjoin to get them back in the result.
WITH
SET ["2001"] As ' {[Date].[2001].[Quarter 1].[January].[1]:[date].[2001].[Quarter 4].[December].[31]}'
member [Date].["2001"]
as 'Aggregate(["2001"])'
SET ["2000"] As ' {[Date].[2000].[Quarter 1].[January].[1]:[date].[2000].[Quarter 4].[December].[29]}'
member [Date].["2000"]
as 'Aggregate(["2000"])'
SELECT {[Measures].[Sales],[Measures].[Margin]}
ON COLUMNS ,
CrossJoin ({[Date].["2000"],[Date].["2001"]},[Catalog Section].[Group].members) ON ROWS
FROM [Invoice] where ([Contract].[Contract].&[AC], [Invoice Category].&[P])
The result is this...
"2000" - Section 1 - $ - $
- Section 2 - $ - $
"2001" - Section 1 - $ - $
- Section 2 - $ - $
We use Queries through Query Ananlyzer and stored Procs so we commonly wrap them in OPENQUERY like the Following:
SELECT * FROM
OPENQUERY(cpmarketing,
'WITH
SET ["2001"] As '' {[Date].[2001].[Quarter 1].[January].[1]:[date].[2001].[Quarter 4].[December].[31]}''
member [Date].["2001"]
as ''Aggregate(["2001"])''
SET ["2000"] As '' {[Date].[2000].[Quarter 1].[January].[1]:[date].[2000].[Quarter 4].[December].[29]}''
member [Date].["2000"]
as ''Aggregate(["2000"])''
SELECT {[Measures].[Sales],[Measures].[Margin]}
ON Columns ,
CrossJoin ({[Date].["2001"],[Date].["2000"]},[Catalog Section].[Group].members) ON Rows
FROM [Invoice] where ([Contract].[Contract].&[AC], [Invoice Category].&[P])')
This returns the following:
Section 1 - $ - $
Section 2 - $ - $
Section 1 - $ - $
Section 2 - $ - $
There is no distinction of the date ranges anymore...
Any ideas on how to get them into the result set so it
returns like
"2000" - Section 1 - $ - $
"2000" - Section 2 - $ - $
"2001" - Section 1 - $ - $
"2001" - Section 2 - $ - $
Thanks For Any help