Since I'm not clear about your scenario, here's an example from
Adventure Works, using the [End of Day Rate] measure with LastNonEmpty
aggregation:
Quote:
|
select {[Measures].[End of Day Rate]} on 0,
|
{[Destination Currency].[Destination Currency].&[Argentine Peso],
[Destination Currency].[Destination Currency].&[Deutsche Mark],
[Destination Currency].[Destination Currency].&[EURO],
[Destination Currency].[Destination Currency].&[French Franc]} on 1
from [Adventure Works]
where [Source Currency].[Source Currency].&[US Dollar]
------------------------------------------------------
End of Day Rate
Argentine Peso .27
Deutsche Mark .47
EURO .97
French Franc .14
These are the last exchange rates for each of 4 currencies - but, if you
browse the cube, there is no data for the DM and FF after 2001. If you
aggregate these 4, values of all 4 on the last date with any data will
be summed (as you also observed for your scenario). So there is no
contribution from the DM (.47) and FF (.14):
Quote:
|
With Member [Destination Currency].[Destination Currency].[Agg4] as
|
Aggregate({[Destination Currency].[Destination Currency].&[Argentine
Peso],
[Destination Currency].[Destination Currency].&[Deutsche Mark],
[Destination Currency].[Destination Currency].&[EURO],
[Destination Currency].[Destination Currency].&[French Franc]})
select {[Measures].[End of Day Rate]} on 0,
[Destination Currency].[Destination Currency].[Agg4] on 1
from [Adventure Works]
where [Source Currency].[Source Currency].&[US Dollar]
----------------------------------------------------------
End of Day Rate
Agg4 1.24
But if instead you sum these 4 currencies, then the last exchange rate
for each is summed, regardless of the date on which that occurs. So the
contribution from the DM (.47) and FF (.14) is now included:
Quote:
|
With Member [Destination Currency].[Destination Currency].[Sum4] as
|
Sum({[Destination Currency].[Destination Currency].&[Argentine Peso],
[Destination Currency].[Destination Currency].&[Deutsche Mark],
[Destination Currency].[Destination Currency].&[EURO],
[Destination Currency].[Destination Currency].&[French Franc]})
select {[Measures].[End of Day Rate]} on 0,
[Destination Currency].[Destination Currency].[Sum4] on 1
from [Adventure Works]
where [Source Currency].[Source Currency].&[US Dollar]
----------------------------------------------------------
End of Day Rate
Sum4 1.85
- Deepak
Deepak Puri
Microsoft MVP - SQL Server
*** Sent via Developersdex http://www.developersdex.com ***