I'm trying to show the total closing balance by month for the dataset below:
[Tranche] [Maturity Date] [Balance]
T1 1-Jan-16 1000
T2 2-Jan-16 200
T3 1-Jan-16 3000
T3 3-Jan-16 2900
T1 31-Jan-16 1000
T2 1-Feb-16 200
T3 31-Jan-16 3000
T3 2-Feb-16 2900
I have joined the dataset (table LoanSched) with a dates lookup table (Dates).
Here's the DAX calculated field formula:
=CALCULATE (
SUM(LoanSched[Balance]),
FILTER ( Dates, Dates[FullDate] = MAX(LoanSched[Maturity Date]) )
)
However, I get the result below which is incorrect. Since Tranche T2's balance ends on a date earlier than T3, the balance is excluded in the monthly total. The way the dataset works, is that the total balance should included balances that appear on the last day of each month and tranche. I'm missing the tranche condition.
I need to calculate the correct balances (highlighted in yellow) below: