Forum Discussion
Amortization Cumulative Schedule DAX and Power BI Help
- 5 years ago
Hi, farooqk_aziz
Due to the nature of work, we only respond to forum posts.
In view of your larger needs, I try my best to perfect your needs. Your method isn't very good which causes many problems,and I will give my ideas here.
You can sort each id by date(calculate column) to get the period, and then calculate what you want in a summarize table, so that the total can be automatically kept correct.
Like this:
period = RANKX ( FILTER ( ALL ( 'Lease Contracts' ), [LeaseID] = EARLIER ( 'Lease Contracts'[LeaseID] ) ), [Rent Date], , ASC )Table = ADDCOLUMNS ( ADDCOLUMNS ( ADDCOLUMNS ( SUMMARIZE ( 'Lease Contracts', [period], [LeaseID], [Rent Date], [Present Value], [Rent], "Beginning balance", VAR PV = CALCULATE ( SUM ( 'Lease Contracts'[Present Value] ), FILTER ( ALL ( 'Lease Contracts' ), [LeaseID] = SELECTEDVALUE ( 'Lease Contracts'[LeaseID] ) ) ) VAR I = 0.0033 VAR Series = SELECTEDVALUE ( 'Lease Contracts'[period] ) VAR Payment = SELECTEDVALUE ( 'Lease Contracts'[Rent] ) 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 ), 0 ) RETURN Result ), "Interest", [Beginning balance] * 0.0033 ), "Ending balance", IF ( [Beginning balance] - ( [Rent] - [Interest] ) >= 0, [Beginning Balance] - ( [Rent] - [Interest] ), 0 ) ), "Principal", IF ( [Rent] - [Interest] >= 0, [Rent] - [Interest], 0 ) )Here is my sample .pbix file.Hope it helps.
If it doesnβt solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 5 years ago
Hello, @BI49
What I wrote to you before has perfectly solved your first problem, and there is no problem with the data. If you want to see the balance based on the date, simply create a table visual without period and πππ
Like this:
Best regards
Janey Guo
If this post helps,then consider Accepting it as the solution to help other members find it faster.
v-janeyg-msft please check your community inbox, as I am not able to post it here. It is keep giving error while posting.
Hi, farooqk_aziz
Due to the nature of work, we only respond to forum posts.
In view of your larger needs, I try my best to perfect your needs. Your method isn't very good which causes many problems,and I will give my ideas here.
You can sort each id by date(calculate column) to get the period, and then calculate what you want in a summarize table, so that the total can be automatically kept correct.
Like this:
period =
RANKX (
FILTER (
ALL ( 'Lease Contracts' ),
[LeaseID] = EARLIER ( 'Lease Contracts'[LeaseID] )
),
[Rent Date],
,
ASC
)Table =
ADDCOLUMNS (
ADDCOLUMNS (
ADDCOLUMNS (
SUMMARIZE (
'Lease Contracts',
[period],
[LeaseID],
[Rent Date],
[Present Value],
[Rent],
"Beginning balance",
VAR PV =
CALCULATE (
SUM ( 'Lease Contracts'[Present Value] ),
FILTER (
ALL ( 'Lease Contracts' ),
[LeaseID] = SELECTEDVALUE ( 'Lease Contracts'[LeaseID] )
)
)
VAR I = 0.0033
VAR Series =
SELECTEDVALUE ( 'Lease Contracts'[period] )
VAR Payment =
SELECTEDVALUE ( 'Lease Contracts'[Rent] )
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 ),
0
)
RETURN
Result
),
"Interest", [Beginning balance] * 0.0033
),
"Ending balance",
IF (
[Beginning balance] - ( [Rent] - [Interest] ) >= 0,
[Beginning Balance] - ( [Rent] - [Interest] ),
0
)
),
"Principal",
IF ( [Rent] - [Interest] >= 0, [Rent] - [Interest], 0 )
)Here is my sample .pbix file.Hope it helps.
If it doesnβt solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- farooqk_aziz5 years ago
Advocate I
the cumulative beginning balance suppose to be 91003 which is the sum of all beginning balance for all the leases except 35 and 38 as both Leases 35 and 38 started at April 2019(Period 4) and March 2019 (Period 3) respecitively, and they added according to it. Lease 35 value is 13210 (April 2019, period 4), and Lease 38 is 13210(March 2019, period 3). Please see the table below , so Lease 38 total Present value (13210) will add in March(Period 3) of Amortization Beg Balance, and Lease 35(13210) will add in April 2014 (period 4) as per your forumula is picking in period 1 for lease 35 and 38 which is not correct. I tried to do it, but couldn't. your help will be appreciated it.
microsoft amortization
please see period 1,2,3,4so these two lease supposed to be adjusted in amortization schedule in beginning balance by adding to period period 3 and period 4 during maortization balance (please see the table below). please help. I really appreciate your last effort
- v-janeyg-msft5 years ago
Community Support
Hello, @BI49
What I wrote to you before has perfectly solved your first problem, and there is no problem with the data. If you want to see the balance based on the date, simply create a table visual without period and πππ
Like this:
Best regards
Janey Guo
If this post helps,then consider Accepting it as the solution to help other members find it faster.
- farooqk_aziz5 years ago
Advocate I
v-janeyg-msft thank you I modified your above query as per my actual model, and it works. Thank you for all your support.
- AndresFromeroS3 years agoNew Member
Hello Janey,
Could you share your solution? please. The link is broken.
Thanks