[EDIT: Example was not entirely correct]
I've been pulling my hair out on this MDX issue... I am making a cube concerning billing.
I have 2 (relevant) dimensions: budgetbill and month
And one measure: Amount
budgetbill date Amount
1548632 2012-11-04 50
1548632 2012-11-23 40 <--
1548632 2012-12-16 70 <--
1724687 2012-10-02 120
1724687 2012-10-23 170
1724687 2012-10-89 200 <--
TOTAL 310
I also have a Date Hierarchy [BB UpdateDate]
Year - Quarter - Month - Week - Date
So I need to have the last amount per Month, over the budgetbill.
In the above example 40 + 70 + 200 = 310
One of the mdx code snippets I've tried
with member [Measures].[test] as
Sum(Tail(nonempty(Descendants([BB UpdateDate].[BB UpdateDate Hierarchy].currentmember, [BB UpdateDate].[Month])
,[Measures].[Amount]), 1),[Measures].[Amount])
select [Measures].[test] on columns
,nonempty([BB UpdateDate].[Month]) on rows
from [BudgetBill]
where {[BudgetBill].[BudgetBillNr].&[1548632],[BudgetBill].[BudgetBill].&[1724687]}
Gives 120 + 170 + 200 = 490 --> Not correct... This is just a (close) example but I tried so many things!
Thanks in advance for any help!!