dbTalk Databases Forums  

Dynamic Filter on Time Dimension

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


Discuss Dynamic Filter on Time Dimension in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
john.r.carter@bankofamerica.com
 
Posts: n/a

Default Dynamic Filter on Time Dimension - 01-17-2006 , 10:51 AM






Does anyone know how I would change the below query to dynamically
select only the data for the current month?

With
MEMBER [Measures].[dayname] AS '[Time].CurrentMember.PROPERTIES
("dayname")'
SELECT
{[Measures].[dayname] ,[Measures].[Net Purchase Amount]}ON COLUMNS,
{[Time].[Day].Members} ON ROWS
FROM [Payments and Purchases]

Thank You in advance,
John C


Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Dynamic Filter on Time Dimension - 01-17-2006 , 05:27 PM






Hi John,

It depends on how "current month" is determined for your Time dimension
and processing setup. A simple scenario would be where the Time
dimension always ends at the current date, so the current month (whether
complete or not) would be the last month in the dimension hierarchy:

Quote:
With
MEMBER [Measures].[dayname] AS
'[Time].PROPERTIES("dayname")'
SELECT
{[Measures].[dayname] ,
[Measures].[Net Purchase Amount]}ON COLUMNS,
Descendants(Tail([Time].[Month].Members),
[Time].[Day]) ON ROWS
FROM [Payments and Purchases]
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.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.