dbTalk Databases Forums  

Complex MDX 2

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


Discuss Complex MDX 2 in the microsoft.public.sqlserver.olap forum.



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

Default Complex MDX 2 - 08-09-2003 , 03:14 PM






In real world ,a frequent requirement is to get measure values
in a given date range which could or could not span entire year.
E.g I want to show monthly sales of products between
2002-10-23 23:11:00 to 2003-2-24 11:11:00

Now the data range is specified with hours. Even if we ignore hours , date
range is specified at lower level
where as data at monthly or weekly level might be required.
How do we handle this in MDX ?
Regards,
Akshay



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

Default Re: Complex MDX 2 - 08-11-2003 , 07:19 AM







WITH MEMBER MEASURES.[SALES WITHIN DATE RANGE] AS '
SUM(intersect(descendants([TIME_DIM].currentmember, TDATE, SELF),
{[TIME_DIM].[TDATE].[1998-01-24 00:00:00] :
[TIME_DIM].[TDATE].[1998-04-15 00:00:00]}), MEASURES.[SALES])'
SELECT MEASURES.ALLMEMBERS ON COLUMNS,
[TIME_DIM].[MONTH].MEMBERS ON ROWS FROM MCUBE

you can replace the [MONHT] with any level you like in last line

Please Please Please let me know if this worked for you or not in both
cases.

Thanks,

Asim Naveed.

--
Posted via http://dbforums.com

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

Default Re: Complex MDX 2 - 08-11-2003 , 05:41 PM



This works thank you man
"asim73" <member31195 (AT) dbforums (DOT) com> wrote

Quote:
WITH MEMBER MEASURES.[SALES WITHIN DATE RANGE] AS '
SUM(intersect(descendants([TIME_DIM].currentmember, TDATE, SELF),
{[TIME_DIM].[TDATE].[1998-01-24 00:00:00] :
[TIME_DIM].[TDATE].[1998-04-15 00:00:00]}), MEASURES.[SALES])'
SELECT MEASURES.ALLMEMBERS ON COLUMNS,
[TIME_DIM].[MONTH].MEMBERS ON ROWS FROM MCUBE

you can replace the [MONHT] with any level you like in last line

Please Please Please let me know if this worked for you or not in both
cases.

Thanks,

Asim Naveed.

--
Posted via http://dbforums.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.