Friday, February 24, 2012

How to achieve the last Time-selection while iterating in the time-dimension itself ?

Hello
I try to explain my problem with an example:

Page-filter Fields:
&[Year 2003].&[Jan].&[3],
&[Year 2003].&[Jan].&[4],
&[Year 2003].&[Jan].&[5]

(=Multiple Item Selections)

Range in days = 3 days

Behind the scene:

[?] [Mutation] Year 2003 Q1 Jan 1 2 3 3 (=DayRange-1+1) 5 4 2 (=DayRange-2+1) -2 5 1 (=DayRange-3+1) 3 6


I want to achieve this kind of calculation behind the scene:
(3*5)+(2*-2)+(1*3) = 14

[Measures].[MyCalc]=

Sum(
Head(Existing [Date].[Days], 1).Item(0)
:Tail(Existing [Date].[Days], 1).Item(0)
,
[Measures].[Mutation]*[Measures].[?]
)

This is what my pivottable must show me:

[MyCalc] 14

Can someone help me out with [Measures].[?] or is there an other way ?

Kind regards,
Geert.

Hi Geert,

Here's a sample Adventure Works query, using [Measures].[Order Quantity], with individual day values of 7, 8, 7:

>>

With Member [Measures].[WeightedOrders] as

Sum((Existing [Date].[Calendar].[Date].Members) as DayRange,

[Measures].[Order Quantity] *

(DayRange.Count + 1

- Rank([Date].[Calendar].CurrentMember, DayRange)))

select {[Measures].[Order Quantity],

[Measures].[WeightedOrders]} on 0

from [Adventure Works]

where {[Date].[Calendar].[Date].&[552]:

[Date].[Calendar].[Date].&[554]}

Order Quantity WeightedOrders
22 44

>>

|||

This code was very helpful

(DayRange.Count + 1 - Rank([Date].[Calendar].CurrentMember, DayRange)

Thank you very very much ,

Geert.

No comments:

Post a Comment