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 / Getting Subtotal Value...
Power Apps
Answered

Getting Subtotal Value with Collection columns set at Default property.

(0) ShareShare
ReportReport
Posted on by

I have a repeating table with Amount Each, Quantity, and Subtotal.  These fields write to a collection.  The Default property for these fields are set to the collection's corresponding columns: AmountEachCC, QuantityCC, and SubtotalCC.  My subtotal field is currently a text input control.  I need it to calculate the Amount Each * Quantity fields.  Normally, I would enter in the Default property of the subtotal field QuantityCC * AmountEachCC but I can't since it is set to SubtotalCC so it can write that value to the collection.   I hope this makes sense.  Any ideas on how I can get the calculation to work?

Categories:
I have the same question (0)
  • R3dKap Profile Picture
    1,594 on at

    Hi @PowerAid,

    Your post (probably) makes sense but it's a bit hard here to figure out exactly your situation :). A screen capture showing us the various elements you describe would be very helpfull.

    Waiting for your feedback...

  • PowerAid Profile Picture
    on at

    @R3dKap wrote:

    Hi @PowerAid,

    Your post (probably) makes sense but it's a bit hard here to figure out exactly your situation :). A screen capture showing us the various elements you describe would be very helpfull.

    Waiting for your feedback...


    My PowerApp is a budget proposal form.  It connected to a Master Sharepoint list that stores each request and it also has a secondary list that stores all of the child entries for the repeating table.  I am using a gallery as the interface for the repeating table.  The home screen has a button called Create new Budget proposal. OnSelect, it creates a new collection for the repeating table.  Here is the code:

    NewForm(Form1);ClearCollect(RevenuePreDefinedCollection, {CategoryCC: "", AmountEachCC: 0, QuantityCC: 0, SubtotalCC: 0}) ;Navigate(NewItem,ScreenTransition.Cover)

     

    The columns in this collection corespond to the text inputs in the repeating table (gallery).  There is a Save icon next to each gallery entry.  It has the following code:

    Patch(RevenuePreDefinedCollection, ThisItem, {CategoryCC: DropdownPreDeifinedCategories.Selected.Value, AmountEachCC: Value(TextInputAmountEach.Text), QuantityCC: Value(TextInputQuantity.Text), SubtotalCC: Value(TextInputSubtotal.Text)}); Collect(RevenuePreDefinedCollection, {CategoryCC: "Select...", AmountEachCC: 0, QuantityCC: 0, SubtotalCC: 0})

     

    Then once you have all of your revenue entries added, you click on the main Save button which writes the form to SharePoint and writes the child entries to the details list.  The code for the Save button is: SubmitForm.Form1

    The OnSuccess of the form is where the main code comes into play.  It looks like this:

    ForAll(Filter(RevenuePreDefinedCollection,CategoryCC<>"Select..."), Patch('Revenue Pre-Defined Categories', Defaults('Revenue Pre-Defined Categories'), {Title: CategoryCC, AmountEach: AmountEachCC, Quantity: QuantityCC, Subtotal: SubtotalCC, MasterID: Form1.LastSubmit.ID}))

     

    I have attached some screen shots to help explain this.  The Default values of the text inputs in the gallery have to be set to the coresponding columns in the collection.  Then the collection writes the values to the details sharepoint list(RevenuePreDefinedCollection).  My issue is that I need the subtotal text input to be Amount*Quantity.  I would normally place that in the Default property of Subtotal but that is where I have the collection column SubtotalCC. 

     

     

     

     

    Pic2.jpg
    Pic3.jpg
    Pic1.jpg
  • Verified answer
    PowerAid Profile Picture
    on at

    I figured it out! I decided to make all of my collection columns end in "CC" just to help me differentiate them from the SharePoint list fields so AmountEach would be AmountEachCC or QuantityCC. Anyways, instead of making the Default property of the Subtotal text input control be the corresponding collection column (SubtotalCC), I made it TextInputAmountEach*TextInputQuantity. Then on the OnSelect code for the Save icon, I made the Subtotal collection column this: SubtotalCC: Value(TextInputAmountEach*TextInputQuantity) The whole code for my OnSelect property for the Save icon is this:Patch(RevenuePreDefinedCollection, ThisItem, {CategoryCC: DropdownPreDeifinedCategories.Selected.Value, AmountEachCC: Value(TextInputAmountEach.Text), QuantityCC: Value(TextInputQuantity.Text), SubtotalCC: Value(TextInputAmountEach*TextInputQuantity)}); Collect(RevenuePreDefinedCollection, {CategoryCC: "Select...", AmountEachCC: 0, QuantityCC: 0, SubtotalCC: 0})

  • R3dKap Profile Picture
    1,594 on at

    Glad you could find a solution !

  • KatheBlaschke Profile Picture
    28 on at

    I had the same problem and this link enlightened me:  https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-groupby

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 308

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard