cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cnr
Advocate II
Advocate II

Creating a Dynamic Principle and Interest Table

Hi all,

 

I'm attempting to create a table in PowerApps where if I create a Decrease or Increase amount the following Principle amount will update and the interest amount will also update.

 

Would anyone have any ideas on how to go about this ?

 

cnr_1-1651230008227.png

Many thanks,

Conor

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Silvester
Super User
Super User

Sadly Row no 16 is not showing on the image but let me rewrite the formula for you.

Text(
    If(
        ThisItem.ItemDay >= PaydwnDate.SelectedDate And Not(IsBlank(Paydown)),
        ThisItem.Principle - Paydown,
        If(
        ThisItem.ItemDay >= PaydwnDate2.SelectedDate And Not(IsBlank(Paydown2)), 
        ThisItem.Principle - Paydown - Paydown2,
        ThisItem.Principle
        )
    ),
    "#,###,###"
)


If you find this post interesting kindly give a Like or you can accept it as a solution to help others find it.

Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the thread and so other members of the community can find it easily.

View solution in original post

6 REPLIES 6
Silvester
Super User
Super User

which datasource are you planning on using?

Will a new record be created anytime, the calculation is being performed?
Or are you just a updating the record each and every time? 

Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the thread and so other members of the community can find it easily.
kylzbaba
Resolver I
Resolver I

Patch(YourDatasource, SelectedRecord, {PrincipalAmount: PrincipalAmount - Value(InputValue)}) 

 

Patch(YourDatasource, SelectedRecord, {PrincipalAmount: PrincipalAmount + Value(InputValue)}) 

 

If you need to maintain the old values you can create a database to act as log that collects the values and the datetime they were changed.

 

 

If you need the increment and decrement to occur automatically, you can set the above formula on the onchange property of the TextInput control. 

 

 

So basically you have one datasource that has the principle amounts and will get changed when a textinput receives new values in Power Apps. If you like as I mentioned before you can create a different database to collect a log of changes.

cnr
Advocate II
Advocate II

Hi @Silvester , @kylzbaba 

 

Thanks for your reply. I went back and redid this. I think I was making this more complicated then it needed to be, I'm getting the desired output with the below using a ForAll()

 

cnr_0-1651727189222.png

 

Im wondering why though my If statement isnt fully working? - You can see on row No. 3 above that the amount changes by 50000 but not on row No.16. If my if statement off ?

Text(
    If(
        ThisItem.ItemDay >= PaydwnDate.SelectedDate And Not(IsBlank(Paydown)),
        ThisItem.Principle - Paydown,
        ThisItem.ItemDay >= PaydwnDate2.SelectedDate And Not(IsBlank(Paydown2)), 
        ThisItem.Principle - Paydown - Paydown2,
        ThisItem.Principle
    ),
    "#,###,###"
)

 

Silvester
Super User
Super User

Sadly Row no 16 is not showing on the image but let me rewrite the formula for you.

Text(
    If(
        ThisItem.ItemDay >= PaydwnDate.SelectedDate And Not(IsBlank(Paydown)),
        ThisItem.Principle - Paydown,
        If(
        ThisItem.ItemDay >= PaydwnDate2.SelectedDate And Not(IsBlank(Paydown2)), 
        ThisItem.Principle - Paydown - Paydown2,
        ThisItem.Principle
        )
    ),
    "#,###,###"
)


If you find this post interesting kindly give a Like or you can accept it as a solution to help others find it.

Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the thread and so other members of the community can find it easily.
Silvester
Super User
Super User

Hello @cnr has it worked? 

Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the thread and so other members of the community can find it easily.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,944)