RE: PeriodsToDate and (All) member on Time dimension
- From: Kjell Arne <KjellArne@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 2 Mar 2007 02:10:08 -0800
Reed Jacobson was so kind to email me a solution to this issue:
By using Exists I could filter out unwanted members.
member [Measures].[AccQg] as
sum
(
exists
(
[DimDate].[Year - Quarter - Month Of Year - Date
Key].[date].members.item(0):
[DimDate].[Year - Quarter - Month Of Year - Date Key].currentmember
,
DESCENDANTS( [DimDate].[Year - Quarter - Month Of Year - Date
Key].[Year].[2003], [DimDate].[Year - Quarter - Month Of Year - Date
Key].[date], SELF )
)
,measures.Qg
)
select {measures.Qg, [Measures].[AccQg]} on columns,
([DimDate].[Date Key].children) on rows
from [cms db]
where [DimDate].[Year].[2003]
"Kjell Arne" wrote:
Hi.
I'm trying to accumulate a calculated measure from beginning of time scope
to CurrentMember.
This is my calculated measure, Qg:
([Measures].[DynamicPropertyValue],
[Event].[Event].CurrentMember,
[Dynamic Property].[Dynamic Property].[Qg])
I have to do this because the relational db i based on a "open schema" model
and Qg is otherwise just a dimension member.
For "open schema" see
http://blogs.msdn.com/eugenea/archive/2006/05/29/610232.aspx
Using PeriodsToDate to accumulated Qg I use this calculated measure:
sum
(
periodstodate
(
[DimDate].[Year - Quarter - Month Of Year - Date Key].[(All)],
[DimDate].[Year - Quarter - Month Of Year - Date
Key].currentmember
)
,measures.Qg
)
It's working somewhat, but I can't seem to figure out how to specify the
timerange for this last calc. measure. It takes all time into account when
accumulating. I want it to limit calculation to i.e.
[DimDate].[Year - Quarter - Month Of Year - Date Key].[Year].&[2003] :
[DimDate].[Year - Quarter - Month Of Year - Date Key].[Year].&[2004]
somehow.
This is my select as it is now:
select {[Measures].[Qg], [Measures].[AccQg]} on columns,
([DimDate].[Date Key].members) on rows
from (select [DimDate].[Year - Quarter - Month Of Year - Date
Key].[Year].&[2003] on 0 from [cms db])
I've tried to remove the subcube in the from clause and replaced it with
where statements, but I think this is the way it should be. I read this is
supposed to be the way after SQL 2005 SP2.
What am I missing?
Thanks.
regards
Kjell Arne
- Prev by Date: Re: Display no measure for time aggregation?
- Next by Date: Calculate a value based on a dynamic date range
- Previous by thread: Optimization with OLAP possible?
- Next by thread: Calculate a value based on a dynamic date range
- Index(es):
Relevant Pages
|
Loading