Forum Discussion
Summary Table for Amortization Schedule
Hello,
I am looking for some help with creating a summary table to generate an amortization schedule to account for both monthly and annual payments. I attempted to create this using Power Query, but had no luck in getting the annual payments to work correctly so that is why I am trying to do so using a summary table instead.
So far, I have created a summary table using the following DAX:
SummaryTable =
ADDCOLUMNS (
ADDCOLUMNS (
ADDCOLUMNS (
SUMMARIZE (
'Lease Amortization',
'Lease Amortization'[period],
'Lease Amortization'[RSA Form ID],
'Lease Amortization'[Days],
'Lease Amortization'[Present_Value],
'Lease Amortization'[Fixed Payments Amount - Payment Stream 1],
"Payment",
VAR LeaseType =
IF (
MAX('Lease Amortization'[Frequency]) = 1 && 'Lease Amortization'[Days] = DATE(YEAR('Lease Amortization'[Days]), 12, 1),
'Lease Amortization'[Fixed Payments Amount - Payment Stream 1], // Annual lease payment on Dec 1st
IF (
MAX('Lease Amortization'[Frequency]) = 1 && NOT('Lease Amortization'[Days] = DATE(YEAR('Lease Amortization'[Days]), 12, 1)),
0, // Monthly lease payment
'Lease Amortization'[Fixed Payments Amount - Payment Stream 1] // Monthly lease payment
)
)
RETURN
LeaseType,
"Beginning balance",
VAR PV =
CALCULATE (
MIN ( 'Lease Amortization'[Present_Value] ),
FILTER (
ALL ( 'Lease Amortization' ),
'Lease Amortization'[RSA Form ID] = EARLIER('Lease Amortization'[RSA Form ID])
)
)
VAR I = CALCULATE(MIN('Lease Amortization'[Interest_per_period]), FILTER(ALL ( 'Lease Amortization' ),
'Lease Amortization'[RSA Form ID] = EARLIER('Lease Amortization'[RSA Form ID])
))
VAR Series = 'Lease Amortization'[Period]
VAR Frequency = MAX('Lease Amortization'[Frequency])
VAR Payment =
IF (
MAX('Lease Amortization'[Frequency]) = 1 && 'Lease Amortization'[Days] = DATE(YEAR('Lease Amortization'[Days]), 12, 1),
'Lease Amortization'[Fixed Payments Amount - Payment Stream 1], // Annual lease payment on Dec 1st
IF (
MAX('Lease Amortization'[Frequency]) = 1 && NOT('Lease Amortization'[Days] = DATE(YEAR('Lease Amortization'[Days]), 12, 1)),
0, // Monthly lease payment
'Lease Amortization'[Fixed Payments Amount - Payment Stream 1] // Monthly lease payment
)
)
VAR Result =
IF (
PV
* POWER ( 1 + I, Series - 1 )
- Payment
* DIVIDE ( POWER ( 1 + I, Series - 1 ) - 1, I ) >= 0,
PV
* POWER ( 1 + I, Series - 1 )
- Payment
* DIVIDE ( POWER ( 1 + I, Series - 1 ) - 1, I ),
PV
* POWER ( 1 + I, Series - 1 )
)
RETURN
Result
),
"Interest", [Beginning balance] * CALCULATE(MIN('Lease Amortization'[Interest_per_period]), FILTER(ALL ( 'Lease Amortization' ),
'Lease Amortization'[RSA Form ID] = EARLIER('Lease Amortization'[RSA Form ID])
))
),
"Ending balance",
VAR Payment = [Payment]
RETURN
IF (
[Beginning balance] - Payment >= 0,
[Beginning balance] - Payment + [Interest],
0
)
),
"Principal",
VAR Payment = [Payment]
RETURN
IF ( Payment - [Interest] >= 0, Payment - [Interest], 0 )
)
The monthly payments seems to be working correctly, where the calculations and the numbers are matching as intended where ending balance of the previous period is the same as the beginning balance of the next period (as shown in the screenshot below).
However, the issue I am facing right now is that the annual payments is not working correctly. It appears that the numbers are matching correctly except for the periods that have a payment amount and the following period after payment has occured (as shown in the screenshot below).
Does anyone have any idea what the issue could be with my DAX formula and summary table?
Any insights or feedback is much appreciated. I can also share my PBI file if you would like.
Thank you!
2 Replies
- rajendraongole1
Super User
Hi Anonymous - I have adjusted the logic to correctly handle the annual payments and ensure the ending balances are properly calculated.
SummaryTable =
ADDCOLUMNS (
SUMMARIZE (
'Lease Amortization',
'Lease Amortization'[period],
'Lease Amortization'[RSA Form ID],
'Lease Amortization'[Days],
'Lease Amortization'[Present_Value],
'Lease Amortization'[Fixed Payments Amount - Payment Stream 1]
),
"Payment",
VAR LeaseType =
IF (
MAX('Lease Amortization'[Frequency]) = 1 && 'Lease Amortization'[Days] = DATE(YEAR('Lease Amortization'[Days]), 12, 1),
MAX('Lease Amortization'[Fixed Payments Amount - Payment Stream 1]), // Annual lease payment on Dec 1st
IF (
MAX('Lease Amortization'[Frequency]) = 1 && NOT('Lease Amortization'[Days] = DATE(YEAR('Lease Amortization'[Days]), 12, 1)),
0, // Monthly lease payment
MAX('Lease Amortization'[Fixed Payments Amount - Payment Stream 1]) // Monthly lease payment
)
)
RETURN
LeaseType,
"Beginning balance",
VAR PV =
CALCULATE (
MIN ( 'Lease Amortization'[Present_Value] ),
FILTER (
ALL ( 'Lease Amortization' ),
'Lease Amortization'[RSA Form ID] = EARLIER('Lease Amortization'[RSA Form ID])
)
)
VAR I = CALCULATE(
MIN('Lease Amortization'[Interest_per_period]),
FILTER(
ALL ( 'Lease Amortization' ),
'Lease Amortization'[RSA Form ID] = EARLIER('Lease Amortization'[RSA Form ID])
)
)
VAR Series = 'Lease Amortization'[Period]
VAR Frequency = MAX('Lease Amortization'[Frequency])
VAR Payment =
IF (
MAX('Lease Amortization'[Frequency]) = 1 && 'Lease Amortization'[Days] = DATE(YEAR('Lease Amortization'[Days]), 12, 1),
MAX('Lease Amortization'[Fixed Payments Amount - Payment Stream 1]), // Annual lease payment on Dec 1st
IF (
MAX('Lease Amortization'[Frequency]) = 1 && NOT('Lease Amortization'[Days] = DATE(YEAR('Lease Amortization'[Days]), 12, 1)),
0, // Monthly lease payment
MAX('Lease Amortization'[Fixed Payments Amount - Payment Stream 1]) // Monthly lease payment
)
)
VAR Result =
IF (
PV * POWER ( 1 + I, Series - 1 ) - Payment * DIVIDE ( POWER ( 1 + I, Series - 1 ) - 1, I ) >= 0,
PV * POWER ( 1 + I, Series - 1 ) - Payment * DIVIDE ( POWER ( 1 + I, Series - 1 ) - 1, I ),
PV * POWER ( 1 + I, Series - 1 )
)
RETURN
Result,
"Interest",
[Beginning balance] * CALCULATE(
MIN('Lease Amortization'[Interest_per_period]),
FILTER(
ALL ( 'Lease Amortization' ),
'Lease Amortization'[RSA Form ID] = EARLIER('Lease Amortization'[RSA Form ID])
)
),
"Ending balance",
VAR Payment = [Payment]
RETURN
IF (
[Beginning balance] - Payment >= 0,
[Beginning balance] - Payment + [Interest],
0
),
"Principal",
VAR Payment = [Payment]
RETURN
IF ( Payment - [Interest] >= 0, Payment - [Interest], 0 )
)please try the above logic and see the result.
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!- AnonymousNot applicable
Hi rajendraongole1, thank you for your fast reply and help! I have tried the above logic and unfortunately the results is showing as the same and not working correctly for annual payments. Do you know of any other alternative solutions to this issue? I can also share with you my PBI file if that would help at all