I'm trying to do a filter that uses {[Period].[Months].Members} as the
set that will be filtered and uses as the condition of the filter a
reference to the current member of the Period dimension, outside the
set of the filter. To resolve it I've tried to use an alias set, as in
the following expression:
Filter ({[Period].[Months].Members} AS FilterSet,
(FilterSet.CurrentMember,[Schedule].[Amount]) > Rank
([Period].CurrentMember, {[Period].[Months].Members}) – Rank
(FilterSet.CurrentMember, {[Period].[Months].Members})
I want to filter the member of the Period dimension where the tuple
([Period], [Schedule].[Amount]) is more than the distance between the
Period member of the filter set and the current member of Period
dimension (outside the filter set). But, despite that the expression's
syntax is correct, the expression:
Rank ([Period].CurrentMember, {[Period].[Months].Members}) – Rank
(FilterSet.CurrentMember, {[Period].[Months].Members})
Always returns zero, so the AS don't understand that the
[Period].CurrentMember is referencing the external member of the
Period dimension and not the member of the filter set.
Does anybody can help me??
By the way, the formula that I'm trying is simple but a quite complex
to explain, take a look at the following example:
Assume that the values between the vertical bars mean:
Quote:
[Schedule].[Amount of Payments], [Schedule].[Monthly Cost]| |
Jan Feb Mar Apr
Quote:
3,200| |4,100| |2,500| |3,300| |
So, the Monthly Cost 200 of Jan must be added to the result of the
formula in Jan, Feb and Mar, because the Amount of Payments is 3. In
the same way, the Monthly Cost 100 of Feb must be added to the result
formula in Feb, Mar, Apr and May. Therefore, the result of the formula
for the example above should be:
Jan Feb Mar Apr May Jun
200 300 800 900 400 300
And the entire expression that I've tried to calculate this is:
Sum( Filter ({[Period].[Months].Members} AS FilterSet,
(FilterSet.CurrentMember,[Schedule].[Amount of Payments]) >
Rank([Perid].CurrentMember, {[Period].[Months].Members}) - Rank
(FilterSet.CurrentMember, {[Period].[Months].Members})
),
[Schedule].[Monthly Cost])
But it doesn't work because inside a filter condition, for the reason
that the filter set is the [Period].[Months] members, all references
to the CurrentMember of the Period dimension will be understood as the
CurrentMember member of the filter set. One solution could by use also
like a variable, setting its values before enter in the filter
expression, but I don't if its possible.