dbTalk Databases Forums  

UNION function with different sets

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


Discuss UNION function with different sets in the microsoft.public.sqlserver.olap forum.



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

Default UNION function with different sets - 10-12-2004 , 11:19 AM






Hi to all,
I know I can make a Union with sets from the same dimension:

SELECT
{[Measures].[Warehouse Sales]} ON COLUMNS,
UNION(
{[Store].[USA].[WA].Children},
{[Store].[USA].[OR].Children},
ON ROWS
FROM Warehouse


but can I make a union of sets from different dimensions? The following
query raises a Calculation error - unknown error:

SELECT
{[Measures].[Warehouse Sales]} ON COLUMNS,
UNION(
{[Store].[USA].[WA].Children},
{[Product].[Food].Children})
ON ROWS
FROM Warehouse

The reason for this is that I need to present both data on the same page,
and I'm trying not to run 2 different queries.

THX



Reply With Quote
  #2  
Old   
Brian Altmann
 
Posts: n/a

Default RE: UNION function with different sets - 10-12-2004 , 02:49 PM






You can only use Union on sets that have tuples with the same dimensionality,
that is, the same dimensions in the same order.
From what you describe, using two queries would probably be the best practice.
Still, you could use a Union of crossjoins such as:

Union(
{ {[Product].[All Products]} * [Store].[USA].[WA].Children} ,
{[Product].[Food].Children} * { [Store].[All Stores] } )

to retrieve the data you want in one query.

HTH,
Brian
www.geocities.com/brianaltmann/olap.html



"Moco" wrote:

Quote:
Hi to all,
I know I can make a Union with sets from the same dimension:

SELECT
{[Measures].[Warehouse Sales]} ON COLUMNS,
UNION(
{[Store].[USA].[WA].Children},
{[Store].[USA].[OR].Children},
ON ROWS
FROM Warehouse


but can I make a union of sets from different dimensions? The following
query raises a Calculation error - unknown error:

SELECT
{[Measures].[Warehouse Sales]} ON COLUMNS,
UNION(
{[Store].[USA].[WA].Children},
{[Product].[Food].Children})
ON ROWS
FROM Warehouse

The reason for this is that I need to present both data on the same page,
and I'm trying not to run 2 different queries.

THX




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.