web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

With example

(0) ShareShare
ReportReport
Posted on by 725

Hi all

Just tried the With example from Microsofts documentation page showing a simple payments calculator, but all I get is a blank label. Not getting any errors and the formula is referencing to my three sliders. Feel I'm missing the elephant in the room somehow.

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @Corissandageri 

    Please provide the code you used here.

  • R Bakker Profile Picture
    725 on at

    So I literally did a copy and paste. from Here 

    With( { AnnualRate: RateSlider/8/100, // slider moves in 1/8th increments and convert to decimal
     Amount: AmountSlider*10000, // slider moves by 10,000 increment
     Years: YearsSlider, // slider moves in single year increments, no adjustment required
     AnnualPayments: 12 }, // number of payments per year
     With( { r: AnnualRate/AnnualPayments, // interest rate
     P: Amount, // loan amount
     n: Years*AnnualPayments }, // number of payments
     r*P / (1 - (1+r)^-n) // standard interest calculation
     )
    ) 

     

  • Verified answer
    timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Corissandageri 

    It took me a while to figure that out - there's actually a bug with that code sample!

    The Years assignment at the top should be YearsSlider.Value. The original code causes a divide by zero error.

    The following should hopefully work for you.

     

    With( { AnnualRate: RateSlider/8/100, // slider moves in 1/8th increments and convert to decimal
     Amount: AmountSlider*10000, // slider moves by 10,000 increment
     Years: YearsSlider.Value, // slider moves in single year increments, no adjustment required
     AnnualPayments: 12 }, // number of payments per year
     With( { r: AnnualRate/AnnualPayments, // interest rate
     P: Amount, // loan amount
     n: Years*AnnualPayments }, // number of payments
     r*P / (1 - (1+r)^-n) // standard interest calculation
     )
    ) 

     

  • R Bakker Profile Picture
    725 on at

    Hi timl

    Thank you so much, must familiarise myself with both the Slider and the With function a lot more, as they both seem very useful.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard