dbTalk Databases Forums  

giving date range to Cube ?

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


Discuss giving date range to Cube ? in the microsoft.public.sqlserver.olap forum.



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

Default giving date range to Cube ? - 12-01-2005 , 10:55 PM






Say, I have created a Dimension "Invoice" which contains Invoice_No,
Invoice_Date and Invoice_Amount, how can I filter to see the Invoices
between 1st Jan 2005 till 31st Dec 2005.

Do I have to write such query in sql query analyzer or in MDX Builder, I am
using Sql Server 2000 Sp4.

Best Regards,

Luqman



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

Default Re: giving date range to Cube ? - 12-02-2005 , 02:58 AM






You can write the MDX query in the MDX Builder. If you want to run it
in Query Analyzer, you have to use openquery to run the same MDX. Query
Analyzer doesn't understand MDX statements.

Invoice_Amount should be a measure in your case, then you can write a
mdx query like

with set [Invoice].[Date Range] as
'[Invoice].[Invoice_Date].[1/1/2005]:[Invoice].[Invoice_Date].[12/31/2005]'
select <your measure> on columns,
<your dimension> on rows
where ([Invoice].[Date Range])

HTH

Milind


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

Default Re: giving date range to Cube ? - 12-02-2005 , 05:48 AM



Thanks v. much.

How can I name this query and show in Analysis Manager, like other cubes
created with Wizards, because I want to use this query with Crystal Reports.
Do I have to use Create Cube Statement?

Further, can I pass parameters to Date Ranges, instead of fixing the Dates
in Cubes or any alternate to this solution.


Best Regards,

Luqman




"Milind" <milind.bhabal (AT) gmail (DOT) com> wrote

Quote:
You can write the MDX query in the MDX Builder. If you want to run it
in Query Analyzer, you have to use openquery to run the same MDX. Query
Analyzer doesn't understand MDX statements.

Invoice_Amount should be a measure in your case, then you can write a
mdx query like

with set [Invoice].[Date Range] as

'[Invoice].[Invoice_Date].[1/1/2005]:[Invoice].[Invoice_Date].[12/31/2005]'
select <your measure> on columns,
your dimension> on rows
where ([Invoice].[Date Range])

HTH

Milind




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

Default Re: giving date range to Cube ? - 12-02-2005 , 08:55 AM



You can create a stored procedure in SQL server 2000 and write a
openquery statement like below

select * from openquery(ASLinkedServerName, 'MDX Query statement')

ASLinkedServerName is the linked server created in sql server with olap
8.0 as the data provider.

Then you can set the datasource of your crystal report to the above
stored procedure. You can write dynamic sql to add the date parameters
passed from the crystal report.

Let me know if you have further questions

Milind


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.