i'm getting the following error on the code below.
TITLE: Microsoft Visual Studio
Query preparation failed.
ADDITIONAL INFORMATION:
Subselects only support the COLUMNS axis. (msmgdsrv)
I'm trying to replicate in MDX something I do in SQL code where I create two temp tables and then use a exists statement to get the rows from the first temp table that do not exist in the second temp table.
exists((select{ ([CUSTOMER JOB].[By Cust-Title-Job].[Title Name].ALLMEMBERS ) }on columns from ( SELECT ( filter([CUSTOMER JOB].[By Cust-Title-Job].[Title Name], [Measures].[Billed Sales Amount]>0)
) ON COLUMNS FROM ( SELECT ( [PREP CONTROL HDR].[Format Group].&[HP_Misc] ) ON COLUMNS FROM ( SELECT ( (lastperiods(12,tail(filter({[Job Complete Date].[Calendar Full].[Month].members* [Measures].[Billed Sales Amount]} as s, Not IsEmpty(s.current)),1).item(0).item(0))) ) ON COLUMNS FROM [DW PREP ARCHIVE]))) ),
(select{ ([CUSTOMER JOB].[By Cust-Title-Job].[Title Name].ALLMEMBERS ) } ON columns from ( SELECT ( filter([CUSTOMER JOB].[By Cust-Title-Job].[Title Name], [Measures].[Billed Sales Amount]>5000)
) ON COLUMNS FROM ( SELECT ( [PREP CONTROL HDR].[Format Group].&[HP_Misc] ) ON COLUMNS FROM ( SELECT ( (lastperiods(12,tail(filter({[Job Complete Date].[Calendar Full].[Month].members* [Measures].[Billed Sales Amount]} as s, Not IsEmpty(s.current)),1).item(0).item(0))) ) ON COLUMNS FROM [DW PREP ARCHIVE]))) ),
[Measures].[Billed Sales Amount] )
i was able to get the following to run however it seems to be ignoring the Except portion or the code. it only returns the first set not the difference between the sets.
trying to get the difference between two different sets of Customer/ title names
SELECT NON EMPTY { [Measures].[Billed Sales Amount] } ON COLUMNS,
NON EMPTY { ([CUSTOMER JOB].[By Cust-Title-Job].[Title Name].ALLMEMBERS ) } ON ROWS
FROM ( SELECT ( EXCEPT({filter({([CUSTOMER JOB].[By Cust-Title-Job].[Title Name]*[PREP CONTROL HDR].[Format Group].&[HP_Misc])}, [Measures].[Billed Sales Amount]>0)},
{filter({([CUSTOMER JOB].[By Cust-Title-Job].[Title Name]*[PREP CONTROL HDR].[Format Group].&[Prep])}, [Measures].[Billed Sales Amount]>5000)}) ) ON COLUMNS
FROM ( SELECT ( (lastperiods(12,tail(filter({[Job Complete Date].[Calendar Full].[Month].members* [Measures].[Billed Sales Amount]} as s, Not IsEmpty(s.current)),1).item(0).item(0))) ) ON COLUMNS FROM [DW PREP ARCHIVE]))
No comments:
Post a Comment