dbTalk Databases Forums  

MDX Query Between two dates

comp.databases.olap comp.databases.olap


Discuss MDX Query Between two dates in the comp.databases.olap forum.



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

Default MDX Query Between two dates - 01-27-2005 , 04:04 AM






I have an star schema datasource, and an OLAP cube sitting on top of it.

I would like to run an MDX query that does something like:

Give me all the measures, with time on the rows, but I want only the values
between time X and time Y.

The problem, however, is that time X and Y come from a calendar control on a
UI. Thus, I do not know if time X or time Y are in the cube.

Can I do a query that returns all the values and only includes values
between X and Y, where X and Y are not necessarily in the cube ?

Does that make sense ?

Maybe I should illustrate further

I have a time dimension

Time:
id Year Month Day
1 2004 Jan 4
2 2004 Jan 6
3 2004 Jan 8

and a fact table
Fact:
Time_id Volume Response time
1 40 8
2 25 13
3 80 17

I would like to see the volume and response time between Jan 1st 2004 and
March 30th 2004.

Is that possible given the data above ?
If so, then can somebody explain how.

Thanks in advance

to reply remove the _NO_SPAM

bdennehy_NO_SPAM (AT) westglobal (DOT) com



Reply With Quote
  #2  
Old   
YouveGotToBeKidding@nowhere.com
 
Posts: n/a

Default Re: MDX Query Between two dates - 01-27-2005 , 06:56 AM






There is usually very little benefit in using a Surrogate Key for the
Time Dimension (your time_id attribute) as the date is always the
date. Your Time Dimension can be keyed by Date instead of "id".

A Time Dimension should also be extensive.... it should include many
more dates than are evident in your Fact tables.

Then you can select data from your Fact table by Date Range directly,
or via a Join to the Time Dimension.

MichaelR


On Thu, 27 Jan 2005 10:04:37 -0000, "Brian Dennehy"
<denno88_NOSPAM_ (AT) yahoo (DOT) com> wrote:

Quote:
I have an star schema datasource, and an OLAP cube sitting on top of it.

I would like to run an MDX query that does something like:

Give me all the measures, with time on the rows, but I want only the values
between time X and time Y.

The problem, however, is that time X and Y come from a calendar control on a
UI. Thus, I do not know if time X or time Y are in the cube.

Can I do a query that returns all the values and only includes values
between X and Y, where X and Y are not necessarily in the cube ?

Does that make sense ?

Maybe I should illustrate further

I have a time dimension

Time:
id Year Month Day
1 2004 Jan 4
2 2004 Jan 6
3 2004 Jan 8

and a fact table
Fact:
Time_id Volume Response time
1 40 8
2 25 13
3 80 17

I would like to see the volume and response time between Jan 1st 2004 and
March 30th 2004.

Is that possible given the data above ?
If so, then can somebody explain how.

Thanks in advance

to reply remove the _NO_SPAM

bdennehy_NO_SPAM (AT) westglobal (DOT) com



Reply With Quote
  #3  
Old   
Brian Dennehy
 
Posts: n/a

Default Re: MDX Query Between two dates - 01-27-2005 , 08:38 AM



The below is merely an example.

Would you show me an example of an MDX query that would join the two tables
together ? Or something to that effect ?


<YouveGotToBeKidding (AT) nowhere (DOT) com> wrote

Quote:
There is usually very little benefit in using a Surrogate Key for the
Time Dimension (your time_id attribute) as the date is always the
date. Your Time Dimension can be keyed by Date instead of "id".

A Time Dimension should also be extensive.... it should include many
more dates than are evident in your Fact tables.

Then you can select data from your Fact table by Date Range directly,
or via a Join to the Time Dimension.

MichaelR


On Thu, 27 Jan 2005 10:04:37 -0000, "Brian Dennehy"
denno88_NOSPAM_ (AT) yahoo (DOT) com> wrote:

I have an star schema datasource, and an OLAP cube sitting on top of it.

I would like to run an MDX query that does something like:

Give me all the measures, with time on the rows, but I want only the
values
between time X and time Y.

The problem, however, is that time X and Y come from a calendar control
on a
UI. Thus, I do not know if time X or time Y are in the cube.

Can I do a query that returns all the values and only includes values
between X and Y, where X and Y are not necessarily in the cube ?

Does that make sense ?

Maybe I should illustrate further

I have a time dimension

Time:
id Year Month Day
1 2004 Jan 4
2 2004 Jan 6
3 2004 Jan 8

and a fact table
Fact:
Time_id Volume Response time
1 40 8
2 25 13
3 80 17

I would like to see the volume and response time between Jan 1st 2004 and
March 30th 2004.

Is that possible given the data above ?
If so, then can somebody explain how.

Thanks in advance

to reply remove the _NO_SPAM

bdennehy_NO_SPAM (AT) westglobal (DOT) 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.