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 / Collection: calculacte...
Power Apps
Answered

Collection: calculacted value based on value within own record?

(0) ShareShare
ReportReport
Posted on by 48

I'm tyring to build shopping cart type functionality. 

I have a table called tblProducts like {Product_Name: "T-Shirt,Price:20}

I have a collection called colShoppingCart like {colProduct_Name:"T-Shirt",Quantity:2,Product_Total: ???}

 

What I'd like to do is for Product_Total to be something like LookUp(tblProducts,Product_Name = colProduct_Name, Product_Price)*Quantity

 

So, basically, I want to loop through each colShoppingCart Record, lookup the price for the product in the tblProducts table, and then multiply it by Quantity in the colShoppingCart collection.

 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    .

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @oguruma ,

     

    Please try:

     

     

    ForAll(
     colShoppingCart.colProduct_Name As TableB,
     Patch(
     colShoppingCart,
     LookUp(
     colShoppingCart,
     colProduct_Name = TableB[@colProduct_Name]
     ),
     {
     Product_Total: LookUp(
     colShoppingCart,
     colProduct_Name = TableB[@colProduct_Name]
     ).Quantity * LookUp(
     tblProducts,
     Product_Name = TableB[@colProduct_Name]
     ).Price
     }
     )
    )

     

     

     

    Best Regards,

    Bof

  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @oguruma ,

    Much simpler simply adding the column

    AddColumns(
     colShoppingCart,
     "Total_Price",
     LookUp(
     tblProducts,
     Product_Name = colProduct_Name
     ).Price * Quantity
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard