dbTalk Databases Forums  

MDX query question

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


Discuss MDX query question in the microsoft.public.sqlserver.olap forum.



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

Default MDX query question - 05-05-2004 , 01:34 PM






Hello all,

I am using SQL server 2000 Analysis services. I have built a cube for
the purposes of counting products with identifying attributes (or
dimensions).

As an exmaple here are my dimensions:

ArtistOnly:
[Key Letter] (for groupoing purposes 1st letter of Artist)
[Artist]
[PrdId]

TitleOnly:
[Title Letter] (for groupoing purposes 1st letter of Title)
[Title]
[PrdId]


As an example a product could a key letter of "S", an artist of
"Seal", and a title of "Beginning".

Here is my query to return the list of titles of an artist:

select {[Measures].[DistinctCount]} on
columns,Filter([TitleOnly].[Title].members,[Measures].[DistinctCount]=1)
on rows from [Music] where [ArtistOnly].[Artist].[Seal]

Here is my query to return a list of artists based on the title:


select {[Measures].[DistinctCount]} on
columns,Filter([ArtistOnly].[Artist].members,[Measures].[DistinctCount]=1)
on rows from [Music] where [TitleOnly].[Title].[Beginning]


Now I need to return the PrdId(the lowest level in the dimension) in
addition to the artist or title. I have tried using a crossjoin but
this seriously affects the performance of the cube. How can I simply
add the field to the results? Am I missing an obvious solution to this
problem?

Any help or suggestions would be greatly appreciated,

Benny

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

Default MDX query question - 05-05-2004 , 10:56 PM






One approach would be to create a main Product dimension
with just [All] and [PrdID] levels, and with [Artist] and
[Title] Member Properties. Then create [ArtistOnly] and
[TitleOnly] Virtual Dimensions from the Member Properties.
Use a NonEmptyCrossJoin MDX query to add [PrdId] info:

Quote:
select {[Measures].[DistinctCount]} on columns,
NonEmptyCrossJoin(Filter([TitleOnly].[Title].members,
[Measures].[DistinctCount]=1), [Product].[PrdId].Members)
on rows
from [Music]
where [ArtistOnly].[Artist].[Seal]
Quote:

Quote:
-----Original Message-----
Hello all,

I am using SQL server 2000 Analysis services. I have
built a cube for
the purposes of counting products with identifying
attributes (or
dimensions).

As an exmaple here are my dimensions:

ArtistOnly:
[Key Letter] (for groupoing purposes 1st letter of Artist)
[Artist]
[PrdId]

TitleOnly:
[Title Letter] (for groupoing purposes 1st letter of
Title)
[Title]
[PrdId]


As an example a product could a key letter of "S", an
artist of
"Seal", and a title of "Beginning".

Here is my query to return the list of titles of an
artist:

select {[Measures].[DistinctCount]} on
columns,Filter([TitleOnly].[Title].members,[Measures].
[DistinctCount]=1)
on rows from [Music] where [ArtistOnly].[Artist].[Seal]

Here is my query to return a list of artists based on the
title:


select {[Measures].[DistinctCount]} on
columns,Filter([ArtistOnly].[Artist].members,[Measures].
[DistinctCount]=1)
on rows from [Music] where [TitleOnly].[Title].
[Beginning]


Now I need to return the PrdId(the lowest level in the
dimension) in
addition to the artist or title. I have tried using a
crossjoin but
this seriously affects the performance of the cube. How
can I simply
add the field to the results? Am I missing an obvious
solution to this
problem?

Any help or suggestions would be greatly appreciated,

Benny
.


Reply With Quote
  #3  
Old   
benny
 
Posts: n/a

Default Re: MDX query question - 05-06-2004 , 12:56 PM



Thanks Deepak. That worked perfectly.


"Deepak" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
One approach would be to create a main Product dimension
with just [All] and [PrdID] levels, and with [Artist] and
[Title] Member Properties. Then create [ArtistOnly] and
[TitleOnly] Virtual Dimensions from the Member Properties.
Use a NonEmptyCrossJoin MDX query to add [PrdId] info:


select {[Measures].[DistinctCount]} on columns,
NonEmptyCrossJoin(Filter([TitleOnly].[Title].members,
[Measures].[DistinctCount]=1), [Product].[PrdId].Members)
on rows
from [Music]
where [ArtistOnly].[Artist].[Seal]



-----Original Message-----
Hello all,

I am using SQL server 2000 Analysis services. I have
built a cube for
the purposes of counting products with identifying
attributes (or
dimensions).

As an exmaple here are my dimensions:

ArtistOnly:
[Key Letter] (for groupoing purposes 1st letter of Artist)
[Artist]
[PrdId]

TitleOnly:
[Title Letter] (for groupoing purposes 1st letter of
Title)
[Title]
[PrdId]


As an example a product could a key letter of "S", an
artist of
"Seal", and a title of "Beginning".

Here is my query to return the list of titles of an
artist:

select {[Measures].[DistinctCount]} on
columns,Filter([TitleOnly].[Title].members,[Measures].
[DistinctCount]=1)
on rows from [Music] where [ArtistOnly].[Artist].[Seal]

Here is my query to return a list of artists based on the
title:


select {[Measures].[DistinctCount]} on
columns,Filter([ArtistOnly].[Artist].members,[Measures].
[DistinctCount]=1)
on rows from [Music] where [TitleOnly].[Title].
[Beginning]


Now I need to return the PrdId(the lowest level in the
dimension) in
addition to the artist or title. I have tried using a
crossjoin but
this seriously affects the performance of the cube. How
can I simply
add the field to the results? Am I missing an obvious
solution to this
problem?

Any help or suggestions would be greatly appreciated,

Benny
.


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.