dbTalk Databases Forums  

How to get a max value from Dimension in MDX query

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


Discuss How to get a max value from Dimension in MDX query in the microsoft.public.sqlserver.olap forum.



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

Default How to get a max value from Dimension in MDX query - 11-04-2004 , 11:52 AM






Hi,
I'm new to the MDX query. I've built below MDX query to pull a MTD,
YTD, LYTD FSR_CASES. I've created the members "FSR_CASES_MTD",
"FSR_CASES_YTD" in "FSR_PROD_CUBE". The goal is, I want to pull the
year todate, last year todate, this year month todate, and last year
month todate of "FSR_CASES" from "FSR_PROD_CUBE". The problem is, I
don't know what's the max date in the dimension "TIME_DIM", in below
query, I have to specify the max date myself which is "20041021". Is
there a better way to do this?


WITH
MEMBER [Measures].[OCT-2003 MTD] AS '([Measures].[FSR_CASES_MTD],
[TIME_DIM].[20031021])'
MEMBER [Measures].[OCT-2004 MTD] AS '([Measures].[FSR_CASES_MTD],
[TIME_DIM].[20041021])'
MEMBER [Measures].[CM%] AS 'iif(isEmpty([Measures].[OCT-2003
MTD]),0,([Measures].[OCT-2004 MTD]-[Measures].[OCT-2003
MTD])*100/[Measures].[OCT-2003 MTD])'
MEMBER [Measures].[2003 YTD] AS '([Measures].[FSR_CASES_YTD],
[TIME_DIM].[20031021])'
MEMBER [Measures].[2004 YTD] AS '([Measures].[FSR_CASES_YTD],
[TIME_DIM].[20041021])'
MEMBER [Measures].[YTD%] AS 'iif(isEmpty([Measures].[2003
YTD]),0,([Measures].[2004 YTD]-[Measures].[2003
YTD])*100/[Measures].[2003 YTD])'

select {[Measures].[OCT-2003 MTD] , [Measures].[OCT-2004 MTD]
,[Measures].[CM%], [Measures].[2003 YTD] , [Measures].[2004 YTD]
,[Measures].[YTD%] } on columns, NON EMPTY
{Descendants([BROKERHIERARCHY].[0001], [AREADIRECTORID])} DIMENSION
PROPERTIES [BROKERHIERARCHY].[AREADIRECTORID].[DisplayName] on rows
from FSR_PROD_CUBE

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.