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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / URGENT:How to calculat...
Power Apps
Unanswered

URGENT:How to calculate remainder from excel table and show it on PowerApps

(0) ShareShare
ReportReport
Posted on by 39

4ab0ef0591f22d14faac7d53bf870a1f.png

The top image shows an example of 3 users entering in bought used and remaining items , I want to implement into my power apps where it automatically calculates the remaining amount and displays it onto the screen. So far ive tried subtracting bought from used but if bought has no value it returns a minus number.

 

I tried subtracting the datacards of Bought and used but after the purchase and putting a new record in where buy amount is not requiried it returns a minus number, how can i overcome this problem, need URGENT HELP.

 

Tried:   Sum(ThisItem.boughtAmount - ThisItem.usedAmount) in data default for dataCard remaining

 

f4d8938b34a22733f965a9e1677d0fa3.png

 

 

 

Categories:
  • tsangd Profile Picture
    39 on at

    If you need additional information please feel free to ask any questions.

  • Mister_Shaik Profile Picture
    1,008 on at

    Hi @tsangd ,

     

    I assume you want to print the remainder as a positive number, irrespective of either Used or Bought data being a greater value,

     

    Then you can use a if condition to compare the values first and then show the positive difference, like below,

    If(ThisItem.boughtAmount > ThisItem.usedAmount, ThisItem.usedAmount-ThisItem.boughtAmount, ThisItem.boughtAmount-ThisItem.usedAmount)

     

    Hope this helps 🙂

     

    Kind Regards,

    Shaik Sha
    ________________________________________________________________________

    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • tsangd Profile Picture
    39 on at

    Thank you for your reply , where would this code go?
    Rather than print the remainder as a positive, i want to take the remainder from the previous record and minus that from the current boughtAmount that the user inputs

    E.g   A User   Bought 10   - Used 0 Remaining 10
    next record:  A User bought 0 used 3 remaining 7
    And this would continue until the remaining is 0.

  • Mister_Shaik Profile Picture
    1,008 on at

    Hi @tsangd ,

     

    The above code goes to the Default property of Remaining Amount field and will replace your Sum function,

    Mister_Shaik_0-1644470200463.png

     

    You want to get the remainder after subtracting with previous remainder? We can still do this, but it depends on how and what controls you are using, can you explain a few things?

    • What is your data source? SharePoint List or Excel?
    • Do you have a gallery to display all the data? are you showing the form on click of a gallery/data table item?
    • In your form, how are identifying if a record that you're editing belongs to a particular user? how are you getting the latest record of that user?

     

    Regards,

    Shaik Sha

     

  • tsangd Profile Picture
    39 on at

    Hello @Mister_Shaik ,

    I did as instructed and it doesnt update straight away, only If i refresh the page.

    Q1: 

    • What is your data source? SharePoint List or Excel?

    A: I am using Excel as my database

     

    Q2 

    • Do you have a gallery to display all the data? are you showing the form on click of a gallery/data table item?

    Yes I have a gallery which is very similar to the imported one when you first create a power app application

    Q3: 

    • In your form, how are identifying if a record that you're editing belongs to a particular user? how are you getting the latest record of that user?

    Unfornately I have not implemented a way to identify a record belongs to a user other than the name they enter.

     

    Im using a browseGallery as shown in the image to display the records that the user inputs(Apologies its in Japanese.)

    2e5c9a9a0cd2e80eb187353bf136e991.png

    As well as the excel sheet used to retrieve data inputted from the user

    (担当者) Name id

    (購入枚数)Bought amount

    (使用枚数)Used amount

    (残数) Remaining amount7a84d2c4c67e9dfde2e0383453128e21.png

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard