cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Luka84
Level: Powered On

Assign a value of a Label to a SharePoint DataCardField

Good day,

I have a PowerApps form with data from a SharePoint list. Some of my fields from SharePoint are "Number" type fields, and I would like to have 1 field as the sum of other Number fields.

For Example: I have a Field called "TOTAL AMOUNT", which should be the sum of other fields (SERVICE 1 AMT, SERVICE 2 AMT, etc..)

I don't seem to be able to achieve this in a formula, so I added a LABEL to the form "and tried to make the "SUMOFAMT" and point the Default Value of my SP Field "TOTAL AMOUNT" to it. "SUMOFAMT" successfully sums the fields, but pointing my SP FIELD "TOTAL AMOUNT" to "SUMOFAMT" doesn't work for some reason.

 

This is the formula for SUMOFAMT:

Value('SERVICE 1 AMT'.Text) + Value('SERVICE 2 AMT'.Text) + Value('SERVICE 3 AMT'.Text) + Value('SERVICE 4 AMT'.Text)  + Value('SERVICE 5 AMT'.Text)  + Value('SERVICE 6 AMT'.Text)  + Value('SERVICE 7 AMT'.Text) 

 

I tried this formula to assigned the value of "SUMOFAMT" to "TOTAL AMOUNT" without any success:

Value(SUMOFAMT.Text)

 

I would like some advice on whether I could directly add the "SUM" formula to my original SP field "TOTAL AMOUNT" or to assign the value of "SUMOFAMT" to "TOTAL AMOUNT"

Many thanks in advance

Luca

3 ACCEPTED SOLUTIONS

Accepted Solutions
QJappie22
Level 8

Re: Assign a value of a Label to a SharePoint DataCardField

Form.pngI filled the SP column Total by placing this line in the Default of DataCardValue5:

Value(DataCardValue2.Text) + Value(DataCardValue3.Text) + Value(DataCardValue4.Text)

In this example the first 2 numbers are text type columns and the 3rd is a number type column. When editing the Form my SP column Total is showing the SUM of the other 3 columns, even if I change one of those 3.

 

The orange circle is a label which holds te same code as above but isn't needed anymore. Is this what you're looking for, or am I on a wrong path here? 

View solution in original post

Dual Super User
Dual Super User

Re: Assign a value of a Label to a SharePoint DataCardField

Hey @Luka84 

 

The issue here is you are putting this formula on DisplayMode property but the formula needs to be added as "Default" property of the data card control.
 
Expression:
Amount Requested DataCard Control -> Default-> Value('SERVICE 1 AMT'.Text) + Value('SERVICE 2 AMT'.Text)
 
This just adds value from two text inputs but you can add other controls in this. Please make sure that you are referring to the text property of the control and not the control itself.
 
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!

View solution in original post

Community Support Team
Community Support Team

Re: Assign a value of a Label to a SharePoint DataCardField

Hi @Luka84 ,

Could you please share a bit more about the "AMOUNT REQUESTED" field in your SP list? Is it a Number type column?

Do you want to populate the calculation value within the "AMOUNT REQUESTED" field based on the 'SERVICE 1 AMT' field value, 'SERVICE 2 AMT' field value, ...?

 

Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. Please consider set the Default property of the "AMOUNT REQUESTED" field Text Input box to following:

Sum(
'SERVICE 1 AMT'.Text,
'SERVICE 2 AMT'.Text,
'SERVICE 3 AMT'.Text,
'SERVICE 4 AMT'.Text,
'SERVICE 5 AMT'.Text,
'SERVICE 6 AMT'.Text,
'SERVICE 7 AMT'.Text
)

or

Sum(
     Value('SERVICE 1 AMT'.Text), 
     Value('SERVICE 2 AMT'.Text),
     Value('SERVICE 3 AMT'.Text),
     Value('SERVICE 4 AMT'.Text), 
     Value('SERVICE 5 AMT'.Text), 
     Value('SERVICE 6 AMT'.Text), 
     Value('SERVICE 7 AMT'.Text)
)

If the issue still exists, please add a Label control (SUMOFAMTLabel) within your app, set the Text property to following:

Sum(
     'SERVICE 1 AMT'.Text, 
     'SERVICE 2 AMT'.Text,
     'SERVICE 3 AMT'.Text,
     'SERVICE 4 AMT'.Text, 
     'SERVICE 5 AMT'.Text, 
     'SERVICE 6 AMT'.Text, 
     'SERVICE 7 AMT'.Text
)

Then set the Default property of the "AMOUNT REQUESTED" field Text Input box to following:

Value(SUMOFAMTLabel.Text)

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

16 REPLIES 16
QJappie22
Level 8

Re: Assign a value of a Label to a SharePoint DataCardField

Hi @Luka84,

 

The thing you are trying to do sounds to me like an easy fix if you tackle the problem at its source. I would advise you to create a Calculated Column in your SharePoint list. How to use Formulas in this Column is explained here:

https://support.office.com/en-us/article/examples-of-common-formulas-in-sharepoint-lists-d81f5f21-2b...

 

Hope this helps!

Luka84
Level: Powered On

Re: Assign a value of a Label to a SharePoint DataCardField

Hi @QJappie22 

I understand this is an easy workaround however I believe it gets calculated only when the form is submitted

Is there a way to have this result displayed on my FORM live as when the service costs are insreted by the user?

Screenshot below for reference:

calculation.png

Luka84
Level: Powered On

Re: Assign a value of a Label to a SharePoint DataCardField

I also know we can use a label for this purpose; however my purpose is to have the calculation happen directly on my SharePoint Field "AMOUNT REQUESTED" and then flow onto my SharePoint list, if possible?

QJappie22
Level 8

Re: Assign a value of a Label to a SharePoint DataCardField

Form.pngI filled the SP column Total by placing this line in the Default of DataCardValue5:

Value(DataCardValue2.Text) + Value(DataCardValue3.Text) + Value(DataCardValue4.Text)

In this example the first 2 numbers are text type columns and the 3rd is a number type column. When editing the Form my SP column Total is showing the SUM of the other 3 columns, even if I change one of those 3.

 

The orange circle is a label which holds te same code as above but isn't needed anymore. Is this what you're looking for, or am I on a wrong path here? 

View solution in original post

Luka84
Level: Powered On

Re: Assign a value of a Label to a SharePoint DataCardField

First of all, thank you @QJappie22 for taking time to elaborate and support

I've tried this approach but for some strange reason it doesn't seem to work, I'm so confused at this stage

All field types are set to Number fields; only thing is that the values I want to calculate are on a different form (I have 2 forms on my page) but I don't think this is the reason since both of them are linked to the same data source

Can you please take a quick look?

 

Screenshot below

calculation.png

QJappie22
Level 8

Re: Assign a value of a Label to a SharePoint DataCardField

Hmm, sadly I can't seem to simulate the problem on my side...

I devided the Form into 2 Forms to simulate your situation but in my App it works. You can even leave the Value() out when all the fields evaluated are number fields.

What does the red + say in you code when you hover over it?

Luka84
Level: Powered On

Re: Assign a value of a Label to a SharePoint DataCardField

Hi @QJappie22 

I've got 2 errors depending where I point the mouse

I also noticed that when you select your DataCardValue, only 1 color is displayed while with mine different colors are displayed when adding multiple Values
Could that indicate something?

 

Below for reference:

Screenshot 1: This Data type is not supported for evaluation:


calculate 1.png

 

Screenshot 2: expected Enum value 

 

calculate 2.png

 

Luka84
Level: Powered On

Re: Assign a value of a Label to a SharePoint DataCardField

I even created a label, did the calculations inside the label and tried to assign the value of the label to my datacard but it also gives an error... Sigh
Luka84
Level: Powered On

Re: Assign a value of a Label to a SharePoint DataCardField

@yashag2255,

Can you possibly take a look 😃 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,071)