Re: Advice needed: Dealing with calculated columns in SharePoint and avoiding delegation issues
@Rob_CTL
My preferred way to deal with calculated columns is not to have them at all. To give an example: let's say you have 2 columns Sales and Costs. You want to create a 3rd column called Profit. One way to do this would be to created a calculated column that uses this forumla in the Sharepoint column settings.
[Sales] - [Costs]
I like to have Profit as a number type column instead. How would this work? Let's say a user creates a new entry using an edit form. I include the Profit DataCard but I set the Visible property to False to hide it from view. Then, I put this code in the Default property of the TextInput for Profit. When the form is submitted the Profit is pre-calculated and therefore does not require a complex column.
DataCardValue_Sales - DataCardValue_Costs
Other actions within the app may affect the Sales or the Costs of the transaction. Every time Sales or Costs change the Profit must be updated as well. We can use a PATCH statement to accomplish this.
Patch(
your_datasource_name,
LookUp(your_datasource_name,ID=ID_label.value),
{Profit: Sales - Costs + (lbl_salesChangeAmount - lbl_costs_ChangeAmount)}
)
Hopefully you find this example to be helpful.
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."