dbTalk Databases Forums  

How to query 30 days records from the cube

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


Discuss How to query 30 days records from the cube in the microsoft.public.sqlserver.olap forum.



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

Default How to query 30 days records from the cube - 11-12-2004 , 11:23 PM






Hi everyone,

I am very new to MDX.

There is [Time] dimension, with YEAR, MONTH, DAY three levels.

1. How do I query result from the fact table only include most 80 days
record.

SELECT NONEMPTYcrossJoin([Product].Members,
[Region].Members)
ON COLUMNS
FROM ProductCube

2. Can I retrieve data from one particular Partition ? If I can, what's
syntax ? I have a partition in the cube has only 80 days record.

FROM. CubeName.PartitionName DOES NOT WORK.

Thanks in advance !

MiMi









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

Default Re: How to query 30 days records from the cube - 11-13-2004 , 12:06 AM






By the way, the time dimension is built basing on TIME FIELD (data type is
date) in the fact table, not seperate time table. So there is no seperate
base table for the time dimension. I can not create VIEW of the base table
to fill out the time I do not need. Also I can not retrieve different time
value from the fact table to create a seperate base table for time dimension
due to huge amount of data in the fact table.

But I have a seperate partition in the cube for 80 days record.

Any suggestion.

Thanks.

"MiMi" <pengpengliu (AT) yahoo (DOT) com> wrote

Quote:
Hi everyone,

I am very new to MDX.

There is [Time] dimension, with YEAR, MONTH, DAY three levels.

1. How do I query result from the fact table only include most 80 days
record.

SELECT NONEMPTYcrossJoin([Product].Members,
[Region].Members)
ON COLUMNS
FROM ProductCube

2. Can I retrieve data from one particular Partition ? If I can, what's
syntax ? I have a partition in the cube has only 80 days record.

FROM. CubeName.PartitionName DOES NOT WORK.

Thanks in advance !

MiMi











Reply With Quote
  #3  
Old   
Jéjé
 
Posts: n/a

Default Re: How to query 30 days records from the cube - 11-13-2004 , 10:10 AM



first, you can't access a particular partition.

So, creating a particular partition doesn't help you.
create a special cube instead-of a partition based on these 80days.

Have you tried the "TopCount" function?
TopCount([Dates].[Days].members,80, Measures.Sales)

This function return a set of dates.


"MiMi" <pengpengliu (AT) yahoo (DOT) com> a écrit dans le message de news:
%237BsdbUyEHA.2892 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Quote:
By the way, the time dimension is built basing on TIME FIELD (data type is
date) in the fact table, not seperate time table. So there is no seperate
base table for the time dimension. I can not create VIEW of the base table
to fill out the time I do not need. Also I can not retrieve different time
value from the fact table to create a seperate base table for time
dimension due to huge amount of data in the fact table.

But I have a seperate partition in the cube for 80 days record.

Any suggestion.

Thanks.

"MiMi" <pengpengliu (AT) yahoo (DOT) com> wrote in message
news:%23afwfDUyEHA.3908 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hi everyone,

I am very new to MDX.

There is [Time] dimension, with YEAR, MONTH, DAY three levels.

1. How do I query result from the fact table only include most 80 days
record.

SELECT NONEMPTYcrossJoin([Product].Members,
[Region].Members)
ON COLUMNS
FROM ProductCube

2. Can I retrieve data from one particular Partition ? If I can, what's
syntax ? I have a partition in the cube has only 80 days record.

FROM. CubeName.PartitionName DOES NOT WORK.

Thanks in advance !

MiMi













Reply With Quote
  #4  
Old   
MiMi
 
Posts: n/a

Default Re: How to query 30 days records from the cube - 11-15-2004 , 07:39 AM



Thanks for pointing me to the function. The origianl fact table has huge
amount of data. I can not create a seperate base table basing on it. It
takes too long to run the query to create seperate table only with 80 days
records in it.

I use the TOPCOUNT in my following query, it return the individual 80 days
measurement. How do I get total measurement of 80 days instead of displaying
individual day's result ?

SELECT NONEMPTYcrossJoin([Product].Members,
[Region].Members) ON COLUMNS,
TopCount([Dates].[Days].members,80) ON ROWS
FROM ProductCube

Any suggestion ?

Thanks,

"Jéjé" <willgart (AT) BBBhotmailAAA (DOT) com> wrote

Quote:
first, you can't access a particular partition.

So, creating a particular partition doesn't help you.
create a special cube instead-of a partition based on these 80days.

Have you tried the "TopCount" function?
TopCount([Dates].[Days].members,80, Measures.Sales)

This function return a set of dates.


"MiMi" <pengpengliu (AT) yahoo (DOT) com> a écrit dans le message de news:
%237BsdbUyEHA.2892 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
By the way, the time dimension is built basing on TIME FIELD (data type
is date) in the fact table, not seperate time table. So there is no
seperate base table for the time dimension. I can not create VIEW of the
base table to fill out the time I do not need. Also I can not retrieve
different time value from the fact table to create a seperate base table
for time dimension due to huge amount of data in the fact table.

But I have a seperate partition in the cube for 80 days record.

Any suggestion.

Thanks.

"MiMi" <pengpengliu (AT) yahoo (DOT) com> wrote in message
news:%23afwfDUyEHA.3908 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hi everyone,

I am very new to MDX.

There is [Time] dimension, with YEAR, MONTH, DAY three levels.

1. How do I query result from the fact table only include most 80 days
record.

SELECT NONEMPTYcrossJoin([Product].Members,
[Region].Members)
ON COLUMNS
FROM ProductCube

2. Can I retrieve data from one particular Partition ? If I can, what's
syntax ? I have a partition in the cube has only 80 days record.

FROM. CubeName.PartitionName DOES NOT WORK.

Thanks in advance !

MiMi















Reply With Quote
  #5  
Old   
Jéjé
 
Posts: n/a

Default Re: How to query 30 days records from the cube - 11-15-2004 , 06:14 PM



try:
sum(topcount([Dates].[Days].members,80, measures.sales), measures.sales)

which display the sum of the top 80 days.

To improove the performance, in your cube
create a named set which return the 80 top days:
Top80days = topcount([Dates].[Days].members,80, measures.sales

then use this named set in your sum:
sum(top80days, measures.sales)

you can create a calculated measure:
Top 80 Days Sales = sum(top80days, measures.sales)

"MiMi" <pengpengliu (AT) yahoo (DOT) com> a écrit dans le message de news:
usujTixyEHA.824 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
Quote:
Thanks for pointing me to the function. The origianl fact table has huge
amount of data. I can not create a seperate base table basing on it. It
takes too long to run the query to create seperate table only with 80 days
records in it.

I use the TOPCOUNT in my following query, it return the individual 80 days
measurement. How do I get total measurement of 80 days instead of
displaying individual day's result ?

SELECT NONEMPTYcrossJoin([Product].Members,
[Region].Members) ON COLUMNS,
TopCount([Dates].[Days].members,80) ON ROWS
FROM ProductCube

Any suggestion ?

Thanks,

"Jéjé" <willgart (AT) BBBhotmailAAA (DOT) com> wrote in message
news:uSdM8rZyEHA.3808 (AT) tk2msftngp13 (DOT) phx.gbl...
first, you can't access a particular partition.

So, creating a particular partition doesn't help you.
create a special cube instead-of a partition based on these 80days.

Have you tried the "TopCount" function?
TopCount([Dates].[Days].members,80, Measures.Sales)

This function return a set of dates.


"MiMi" <pengpengliu (AT) yahoo (DOT) com> a écrit dans le message de news:
%237BsdbUyEHA.2892 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
By the way, the time dimension is built basing on TIME FIELD (data type
is date) in the fact table, not seperate time table. So there is no
seperate base table for the time dimension. I can not create VIEW of the
base table to fill out the time I do not need. Also I can not retrieve
different time value from the fact table to create a seperate base table
for time dimension due to huge amount of data in the fact table.

But I have a seperate partition in the cube for 80 days record.

Any suggestion.

Thanks.

"MiMi" <pengpengliu (AT) yahoo (DOT) com> wrote in message
news:%23afwfDUyEHA.3908 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hi everyone,

I am very new to MDX.

There is [Time] dimension, with YEAR, MONTH, DAY three levels.

1. How do I query result from the fact table only include most 80 days
record.

SELECT NONEMPTYcrossJoin([Product].Members,
[Region].Members)
ON COLUMNS
FROM ProductCube

2. Can I retrieve data from one particular Partition ? If I can, what's
syntax ? I have a partition in the cube has only 80 days record.

FROM. CubeName.PartitionName DOES NOT WORK.

Thanks in advance !

MiMi

















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.