Hello,
On SharePoint I have two columns "Spent" and "Amount" and I would like to be able to do subtractions on a "Total" column but I can't get subtractions to work on the "Default" PowerApps box.
Is it possible ?
If so what is the procedure to follow please
Spent = 34
Ammount = 11
34 - 11 = 23
TOTAL column = 23.
Thanks you advance, GL.
Solved! Go to Solution.
Hi @Anonymous ,
What is the column type of your "Spent" and "Amount" column? Are they both Nmuber column?
Where do you want to display this "Total" column?
I assume your "Spent" and "Amount" column are Number column, and you want to display this “Total” column inside a DataTable. You can do the calculation inside PowerApps. I will give you the detailed steps about how to achieve this:
1. Create a new list called “subtract” with two Number column named “Spent” and “Amount”:
2. Go to your app and add a DataTable, set the Items property of this DataTable as below(remember to replace your own SP list name):
AddColumns(subtract,"Total",Spent-Amount)
3. Go to the Properties pane of this DataTable, click “Edit fields” to add the new column added in step 2.
4. This time, check the results in your Data table:
If you create a new list item in SP list, and refresh your data source inside the app, you will see the new added record in the DataTable:
Note:
Best Regards,
Allen
@Anonymous
One option is to create a calculated column in SharePoint if you want to store the value. If you want to display the value in App, then you can use the below expression:
Value(DataCardValue1.Text) - Value(DataCardValue2.Text)
Here, you need to replace DataCardValue1 with the control name for Spent and DataCardValue2 with the control name for Amount.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hi @Anonymous ,
What is the column type of your "Spent" and "Amount" column? Are they both Nmuber column?
Where do you want to display this "Total" column?
I assume your "Spent" and "Amount" column are Number column, and you want to display this “Total” column inside a DataTable. You can do the calculation inside PowerApps. I will give you the detailed steps about how to achieve this:
1. Create a new list called “subtract” with two Number column named “Spent” and “Amount”:
2. Go to your app and add a DataTable, set the Items property of this DataTable as below(remember to replace your own SP list name):
AddColumns(subtract,"Total",Spent-Amount)
3. Go to the Properties pane of this DataTable, click “Edit fields” to add the new column added in step 2.
4. This time, check the results in your Data table:
If you create a new list item in SP list, and refresh your data source inside the app, you will see the new added record in the DataTable:
Note:
Best Regards,
Allen
what about when it's more than two values? how do you subtract those
I have the same logic app. i am creating the apps for inventory and maintenance job . now i am facing the issue with total qty ,
That is calculated value column. formula is Total qty = order qty + in stock qty - consumable qty . Also IN stock qty is calculated value = order qty + Total Qty . I am getting fine result for first entry . But when i am trying to get 2nd time it showing wrong value . can you anyone suggest here .
E.g. 1st entry -->order qty -10
In stock qty - 5
Consumable - 4
total - 11
User | Count |
---|---|
126 | |
87 | |
85 | |
75 | |
69 |
User | Count |
---|---|
215 | |
180 | |
139 | |
97 | |
83 |