dbTalk Databases Forums  

problem with date range

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


Discuss problem with date range in the microsoft.public.sqlserver.olap forum.



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

Default problem with date range - 12-19-2005 , 04:47 AM






Hi,

I am running SQL Server 2000 with Analysis Services and Reporting
Services. I would like to create a report in RS which contains data in
a special date range. The date range is defined by report parameter
with the type of DateTime.

Now I am trying do build a mdx query which returns all data in the date
range.

My first attemp was to create a memberfield like:
SET [filter] AS '[date].[2005].[12].[1] : [date].[2005].[12].[19] '

Unfortunatly this method creates some problems. First the named
dates "2005/12/01" and "2005/12/19" have to exist in my database.
Besides, my time dimension contains weeks instead of month. so this
way is not possible, unless I am programming a function which is
calculating a week number of a date. But this way is not the best one.

So I start using the filter() function. But I never got it running
correctly.
So how do I have to write an mdx-query returnning date between to
dates?

thanks


Reply With Quote
  #2  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: problem with date range - 12-19-2005 , 05:31 AM






Setup the parameters as lists to be populated from a query which hits
the cube and only returns valid date members. You can then use the
unique names of the selected members to construct your query.

--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <1134989274.616499.273910 (AT) g44g2000cwa (DOT) googlegroups.com>,
access.20.mickmack (AT) spamgourmet (DOT) com says...
Quote:
Hi,

I am running SQL Server 2000 with Analysis Services and Reporting
Services. I would like to create a report in RS which contains data in
a special date range. The date range is defined by report parameter
with the type of DateTime.

Now I am trying do build a mdx query which returns all data in the date
range.

My first attemp was to create a memberfield like:
SET [filter] AS '[date].[2005].[12].[1] : [date].[2005].[12].[19] '

Unfortunatly this method creates some problems. First the named
dates "2005/12/01" and "2005/12/19" have to exist in my database.
Besides, my time dimension contains weeks instead of month. so this
way is not possible, unless I am programming a function which is
calculating a week number of a date. But this way is not the best one.

So I start using the filter() function. But I never got it running
correctly.
So how do I have to write an mdx-query returnning date between to
dates?

thanks




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

Default Re: problem with date range - 12-19-2005 , 06:36 AM



Hi Darren,

thanks for your prompt response.

I guess, that is an good idea. But I have to time dimensions, one with
an week-level and one with a month-level. When I create a list for the
parameters out of the cube I will get a something like "19.12.2005
11:11". How can I seperate the week number from this output, without
programming an own function?

thanks


Reply With Quote
  #4  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: problem with date range - 12-20-2005 , 05:45 AM



In article <1134995817.769021.312280 (AT) g14g2000cwa (DOT) googlegroups.com>,
access.20.mickmack (AT) spamgourmet (DOT) com says...
Quote:
Hi Darren,

thanks for your prompt response.

I guess, that is an good idea. But I have to time dimensions, one with
an week-level and one with a month-level. When I create a list for the
parameters out of the cube I will get a something like "19.12.2005
11:11". How can I seperate the week number from this output, without
programming an own function?

thanks

Sorry, but I am having trouble understanding the structure of your
dimensions, you mention 2 dimensions based around weeks and months, but
I am missing something as I don't understand how that relates to
"19.12.2005 11:11" which looks to me like a day and time reference.

Maybe if I expanded on my suggestion we may reach some common
understanding.

If you set a query like the one below as the source for you list of
parameters you can build your own user friendly label using a calculated
member like TimeCaption and you can use the TimeUniqueName as the value
that is pass back to the query so that it can be incorporated straight
back into the MDX

Quote:
WITH
MEMBER Measures.TimeUniqueName as 'Time.CurrentMember.UniqueName'
MEMBER Measures.TimeCaption as '"Month " + Time.CurrentMember.Name +
", " + Ancestor(Time.CurrentMember,Year).Name'
SELECT
Time.Month.Members ON ROWS,
{Measures.TimeUniqueName, Measures.TimeCaption} ON COLUMNS
FROM Sales
Quote:
Note: The above query works with the FoodMart 2000 query that comes with
AS2k.

--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell


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.