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 / How to store in (CDS) ...
Power Apps
Unanswered

How to store in (CDS) Dataverse field the sum of 4 other fields with currency type?

(0) ShareShare
ReportReport
Posted on by 10

Hi ,

I'm building a form with canvas app. I have a Dataverse table with multiple fields, I need to store the total of 4 fields in a total field. Table fields are in form in edit display mode using variable varFormData to display all form in the app.

Scenario:

Table name : Main table

FieldName1 : Type currency 

FieldName2 : Type currency 

FieldName3 : Type currency 

FieldName4 : Type currency 

FieldNameTotal: type currency

I want to store the sum of FieldName1,2,3 and 4 in FieldNameTotal and I want to display the currency symbol ($) in all fields.

I'm using a Text label as a workaround and storing the total field in a collection.

Code I'm using Now is: Text(Value(Sum((DataCardValue25.Text),(DataCardValue27.Text),(DataCardValue29.Text),(DataCardValue31.Text))))

Thanks,

I have the same question (0)
  • codevenkat Profile Picture
    126 on at

    Hi Forge,

    You have to remove currency before adding fields , which is clearly explained in the below topic https://powerusers.microsoft.com/t5/Building-Power-Apps/Sum-Currency-Fields-and-Displaying-Currency-as-s/td-p/195927

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Drew Poggemann Profile Picture
    9,287 Most Valuable Professional on at

    Hi @Forge,

     

    You can define a calculated column in the Dataverse that will do the sum of these four currency values.  I am showing two in the example below but this is a Currency column that is Calculated.

    dpoggemann_0-1628764126783.png

    Hope this helps.  Please accept if answers your question or Like if helps in any way.


    Thanks,


    Drew

  • Forge Profile Picture
    10 on at

    Hi @dpoggemann ,

    I have created 2 calculated fields and used your formula: xxx_FieldName1+xxx_FieldName2+xxx_fieldName3+xxx_FieldName4

    I tried to display the fields in a form (set to new mode) but the total fields cards doesn't show anything. The cards are in: Parent.DisplayMode and the text properties of the cards are set to: Text(Parent.Default, "$###.##").

    Thanks for your help,

    Totalform.PNG

  • Drew Poggemann Profile Picture
    9,287 Most Valuable Professional on at

    Hi @Forge ,

     

    That field will not be populated until it is patched in the database.  If you save the other four fields, it should populate.  Please let me know if I am missunderstanding.

     

    Thanks much!

     

    Drew

  • Forge Profile Picture
    10 on at

    Hi @dpoggemann ,

    I really appreciate your help. This solution is partially good for my app because it stores the sum of the fields but it doesn't give me the ability to show the user in Realtime the total field as they input the data. I need the total field to show the amount in Canadian dollar as the user inputs data.

    Thanks,

  • Prakash4691 Profile Picture
    1,332 on at

    @Forge ,

     

    Modify onchange property of all textinput control to UpdateContext({value2:TextInput1.Text}) to get the modified value. Make sure to have unique context variable in updatecontext like value1, value2 etc.

     

    In total text property, use Sum(value1, value2, value3, value4). You will get instant result on change of those values.

     

    To display currency symbol, modify text property of control to "$" & Text(Sum(value1, value2), "[$-en-US]0.00")

     

    Mark it as solution. If it resolves your question.

     

  • Forge Profile Picture
    10 on at

    Hi ,

    The value in the fields are all currency type and will not accept (TextInput1.Text) function it is formatted as a number (TextFormat.Number). 

  • Prakash4691 Profile Picture
    1,332 on at

    @Forge ,

     

    While displaying show $ symbol. While patching remove $ and just pass number.

     

    Regards,

    Prakash

  • Prakash4691 Profile Picture
    1,332 on at

    @Forge 

     

    As I mentioned earlier, on change property of datacardvalue should be UpdateContext({value2: DataCardValue8.Text})

     

    Default property of the datacardvalue should be If(IsBlank(value2), "$" & Text(Parent.Default, "0.00"), "$" & Text(value2, "0.00"))

     

    Update property of datacard should remain same, don't make any modification i.e. Value(DataCardValue8.Text). In your case datacard value will be different.

     

    Follow above steps for other currency controls too.

     

    As per MS docs, Value function for string format.

    • The string may be prefixed with the currency symbol for the current language. The currency symbol is ignored. Currency symbols for other languages are not ignored.

    I have validated from my side it is working fine.

     

    Let me know if that works for you.

     

    Mark it as resolved, if it answers your question and cheers too.

     

     

    Regards,

    Prakash

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 762

#2
11manish Profile Picture

11manish 640

#3
Valantis Profile Picture

Valantis 548

Last 30 days Overall leaderboard