dbTalk Databases Forums  

MDX and Properties()

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


Discuss MDX and Properties() in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Cristiano Moraes da Silva
 
Posts: n/a

Default MDX and Properties() - 06-07-2004 , 10:08 AM






Hi,

I am new to MDX and Needed help with this logic:
I want to produce this query in my "Employee's cube", for february...

Job (dimension)
Date Job1 Job2 Job3
-----------------------------------------------------------
02.12.03 MISUKY ALBERT
02.13.03 MISUKY JOHN ALBERT
02.14.03 - JOHN ALBERT
02.15.03 ALBERT,
SUE
02.16.03
(...)
--------------------------------------------------------------
I tried this MDX:

SELECT
{ [Jobs].Members } on columns,
{ [Date].[All Date].[2/1/2003] : [Data].[All Data].[02/28/2003] } on rows
FROM
employees
WHERE
( [In Vacation].[Yes] )

this results:
Job (dimension)
Date Job1 Job2 Job3
-----------------------------------------------------------
02.12.03 1 1
02.13.03 1 1 1
02.14.03 1 1
02.15.03 2
02.16.03
--------------------------------------------------------------

I don't know how to display the names. There is a measures that COUNT day.

===========================================
Cristiano Moraes da Silva
SIG Soluções em Informática e Gestão LTDA
Santa Maria - RS - Brasil
cristiano (AT) sigbrasil (DOT) com.br
www.sigbrasil.com.br
+55 552268699



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

Default Re: MDX and Properties() - 06-07-2004 , 10:27 PM






Is there also an [Employee] dimension for the cube, whose Member
Properties provide the names that you need? You could then create a
Calculated Measure to display them.



- Deepak

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #3  
Old   
Cristiano Moraes da Silva
 
Posts: n/a

Default Re: MDX and Properties() - 06-08-2004 , 07:36 AM



Yes, I have the dimension [Employee] and wrote this MDX:

WITH
MEMBER [Measures].[Emp Name] as '
[Employee].CurrentMember.Properties("Name") '
SELECT
{ [Jobs].Members } on columns,
{ [Date].[All Date].[2/1/2003] : [Data].[All Data].[02/28/2003] } on rows
FROM
employees
WHERE
( [Measures].[Emp Name], [In Vacation].[Yes] )

------------------------------------------------------------
....but this returns #ERR ! ...because "Name" propertie are defined for a
single level - [Employee Name].
My [Employee] dimension has the following structure:

[Employee]
[Sex]
[Type]
[Employee Name] // who has the propertie "Name".

===========================================
Cristiano Moraes da Silva
SIG Soluções em Informática e Gestão LTDA
Santa Maria - RS - Brasil
cristiano (AT) sigbrasil (DOT) com.br
www.sigbrasil.com.br
+55 552268699



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

Default Re: MDX and Properties() - 06-08-2004 , 10:27 AM



Then there is a question about your MDX query, since you haven't
included the [Employee] dimension on either rows or columns. Is there
always only 1 employee for a given combination of day and job -
otherwise, [Employee] needs to be added to one of the axes of the query?


- Deepak

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #5  
Old   
Cristiano Moraes da Silva
 
Posts: n/a

Default Re: MDX and Properties() - 06-08-2004 , 12:25 PM



....in some cases there are more then one combination for day and job.
So I need to put [Employee] in one of the axes of the query, ok...something
like this:

SELECT
{ [Jobs].Members } on columns,
{ Crossjoin( [Date].[All Date].[2/1/2003] : [Data].[All
Data].[02/28/2003], [Employee].[Name].Members) } on rows
FROM
Employees
WHERE
( [In Vacation].[Yes] )

Date Job 1
========================
02.01.03 JOHN
02.01.03 SUE
02.01.03 MISUKY
------------------------------------
02.02.03 JOHN
02.02.03 SUE
02.02.03 MISUKY 1
-----------------------------------
02.03.03
02.03.03
02.03.03
-----------------------------------
02.04.03
02.04.03
02.04.03
-----------------------------------
(...)
But I don't want to return blanks!



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

Default Re: MDX and Properties() - 06-08-2004 , 04:47 PM



Will using NonEmptyCrossJoin() give you what you want?

Quote:
SELECT
[Jobs].Members on columns,
NonEmptyCrossJoin([Date].[All Date].[2/1/2003]
: [Date].[All Date].[02/28/2003],
[Employee].[Name].Members) on rows
FROM
Employees
WHERE
([In Vacation].[Yes])
Quote:

- Deepak

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!


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.