dbTalk Databases Forums  

query returns no results - is this no longer correct syntax?

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss query returns no results - is this no longer correct syntax? in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ChrisHarrington
 
Posts: n/a

Default query returns no results - is this no longer correct syntax? - 07-18-2006 , 06:48 PM







WITH
MEMBER [Date].[Fiscal].[DateSet] AS 'SUM({[Date].[Fiscal].[Fiscal
Semester].&[2004]&[1]})'
MEMBER [Employee].[Employee Department].[EmployeeSet] AS 'SUM({
[Employee].[Employee Department].[Department Name].&[Sales].&[Sales
Representative], [Employee].[Employee Department].[Department
Name].&[Sales].&[European Sales Manager], [Employee].[Employee
Department].[Department Name].&[Sales].&[North American Sales Manager]
})'

SELECT
{
[Measures].[Reseller Sales Amount]
}

ON COLUMNS,
NON EMPTY
{
NonemptyCrossJoin (
{[Product].[Product Model Categories].[All Products]},
{[Geography].[Geography].[All Geographies]}
)

}
ON ROWS
FROM [Channel Sales]
WHERE
(
[Date].[Fiscal].[DateSet],
[Employee].[Employee Department].[EmployeeSet]
)

--- chris h.



Reply With Quote
  #2  
Old   
ChrisHarrington
 
Posts: n/a

Default Re: query returns no results - is this no longer correct syntax? - 07-18-2006 , 08:46 PM






done more research. In AS2005 I can say:


SELECT
{
[Measures].[Reseller Sales Amount]
}

ON COLUMNS,
NON EMPTY
{
NonemptyCrossJoin (
{[Product].[Product Model Categories].[All Products]},
{[Geography].[Geography].[All Geographies]}
)

}
ON ROWS
FROM [Channel Sales]
WHERE
(
{[Date].[Fiscal].[Fiscal Semester].&[2004]&[1]},
{[Employee].[Employee Department].[Department Name].&[Sales].&[Sales
Representative], [Employee].[Employee Department].[Department
Name].&[Sales].&[European Sales Manager], [Employee].[Employee
Department].[Department Name].&[Sales].&[North American Sales Manager]}
)

And that works

If I try to define named sets:


WITH
SET [Date Set] AS '{[Date].[Fiscal].[Fiscal Semester].&[2004]&[1]}'
SET [Employee Set] AS '{[Employee].[Employee Department].[Department
Name].&[Sales].&[Sales Representative], [Employee].[Employee
Department].[Department Name].&[Sales].&[European Sales Manager],
[Employee].[Employee Department].[Department Name].&[Sales].&[North American
Sales Manager]}'

SELECT
{
[Measures].[Reseller Sales Amount]
}

ON COLUMNS,
NON EMPTY
{
NonemptyCrossJoin (
{[Product].[Product Model Categories].[All Products]},
{[Geography].[Geography].[All Geographies]}
)

}
ON ROWS
FROM [Channel Sales]
WHERE
(
[Date Set],
[Employee Set]
)


I get error "The definition of the Employee Set set contains a circular
reference." Not sure I understand that.


"ChrisHarrington" <charrington-at-activeinterface.com> wrote

Quote:
WITH
MEMBER [Date].[Fiscal].[DateSet] AS 'SUM({[Date].[Fiscal].[Fiscal
Semester].&[2004]&[1]})'
MEMBER [Employee].[Employee Department].[EmployeeSet] AS 'SUM({
[Employee].[Employee Department].[Department Name].&[Sales].&[Sales
Representative], [Employee].[Employee Department].[Department
Name].&[Sales].&[European Sales Manager], [Employee].[Employee
Department].[Department Name].&[Sales].&[North American Sales Manager]
})'

SELECT
{
[Measures].[Reseller Sales Amount]
}

ON COLUMNS,
NON EMPTY
{
NonemptyCrossJoin (
{[Product].[Product Model Categories].[All Products]},
{[Geography].[Geography].[All Geographies]}
)

}
ON ROWS
FROM [Channel Sales]
WHERE
(
[Date].[Fiscal].[DateSet],
[Employee].[Employee Department].[EmployeeSet]
)

--- chris h.




Reply With Quote
  #3  
Old   
Deepak Puri
 
Posts: n/a

Default Re: query returns no results - is this no longer correct syntax? - 07-19-2006 , 12:24 AM



Hi Chris,

The error message could be due to the fact that the "Where" clause of an
MDX query is resolved before Named Sets in the "With" clause, as
explained in Chapter 4 of MDX Solutions: "MDX Query Context and
Execution". So, maybe the context of the "Where" clause (which specifies
the named sets) is then applied to the computation of the named sets
themsleves, resulting in the circular reference. Of course, a set could
not be directly specified in the AS 2000 "Where" clause, so this
scenario did not exist.

One work-around would be to define intermediate string measures; but
there may be more straightforward solutions?

Quote:
WITH
Member [Measures].[Date String] AS "{[Date].[Fiscal].[Fiscal
Semester].&[2004]&[1]}"
Member [Measures].[Employee String] AS "{[Employee].[Employee
Department].[Department
Name].&[Sales].&[Sales Representative], [Employee].[Employee
Department].[Department Name].&[Sales].&[European Sales Manager],
[Employee].[Employee Department].[Department Name].&[Sales].&[North
American
Sales Manager]}"

SELECT
{
[Measures].[Reseller Sales Amount]
}

ON COLUMNS,
NON EMPTY
{
NonemptyCrossJoin (
{[Product].[Product Model Categories].[All Products]},
{[Geography].[Geography].[All Geographies]}
)

}
ON ROWS
FROM [Channel Sales]
WHERE
(
StrToSet([Measures].[Date String]) as [Date Set],
StrToSet([Measures].[Employee String]) as [Employee Set]
)
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #4  
Old   
ChrisHarrington
 
Posts: n/a

Default Re: query returns no results - is this no longer correct syntax? - 07-20-2006 , 12:54 AM



Thanks Deepak, I'll try that approach also.

"Deepak Puri" <deepak_puri (AT) progressive (DOT) com> wrote

Quote:
Hi Chris,

The error message could be due to the fact that the "Where" clause of an
MDX query is resolved before Named Sets in the "With" clause, as
explained in Chapter 4 of MDX Solutions: "MDX Query Context and
Execution". So, maybe the context of the "Where" clause (which specifies
the named sets) is then applied to the computation of the named sets
themsleves, resulting in the circular reference. Of course, a set could
not be directly specified in the AS 2000 "Where" clause, so this
scenario did not exist.

One work-around would be to define intermediate string measures; but
there may be more straightforward solutions?


WITH
Member [Measures].[Date String] AS "{[Date].[Fiscal].[Fiscal
Semester].&[2004]&[1]}"
Member [Measures].[Employee String] AS "{[Employee].[Employee
Department].[Department
Name].&[Sales].&[Sales Representative], [Employee].[Employee
Department].[Department Name].&[Sales].&[European Sales Manager],
[Employee].[Employee Department].[Department Name].&[Sales].&[North
American
Sales Manager]}"

SELECT
{
[Measures].[Reseller Sales Amount]
}

ON COLUMNS,
NON EMPTY
{
NonemptyCrossJoin (
{[Product].[Product Model Categories].[All Products]},
{[Geography].[Geography].[All Geographies]}
)

}
ON ROWS
FROM [Channel Sales]
WHERE
(
StrToSet([Measures].[Date String]) as [Date Set],
StrToSet([Measures].[Employee String]) as [Employee Set]
)



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.