web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power Apps Sum Values ...
Power Apps
Unanswered

Power Apps Sum Values in Gallery

(0) ShareShare
ReportReport
Posted on by 67

Hi Members,

 

I have a requirement in Power Apps to sum values in a gallery.

 

I have two SharePoint lists has:

  • Product Details
  • ACGH Sales Tracking

'Product Details SharePoint list' has only two columns that have the product name and their cost, as shown below:

 

Gal.jpg

 

The 'ACGH Sales Tracking' SharePoint list has a column called Product [LookUp column from the above list - this allows multiple values] and has another column called 'Numb of the product.'

 

gal1.jpg

 

 

 

 

 

 

 

 

 

My Power Apps gallery is connected to the above list [ACGH Sales Tracking.] In the gallery control, I need to display the total cost for each item.

 

For example, If the customer took a keyboard with 1 product, it should display the price of the keyboard from list 1.

Otherwise, if the user selects two products as [Desktop and Laptop], the text label should give me the sum of the two product price [Desktop price + Laptop price.]

 

For that, I tried in a Text label's Text property to:

 

 

Sum(ForAll(Filter('ACGH Sales Tracking',Product=Concat(ThisItem.Product,Value&","),LookUp('ACGH Product Details',Title=Product,'Product Price'))) * 'Numb of Products')

 

 

 

error11.jpg

 

 

 

 

 

 

Can anyone please suggest how I can achieve this? Thanks in advance!

 

 

 

 

 

 

 

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    Kirkby Profile Picture
    647 Moderator on at
    Re: Power Apps Sum Values in Gallery

     

    Hi @Hemashree 

     

    Since I cannot see the entire screen in your question, I have some limitations in understanding the user interface.

    I would like to explain it as follows.

     

    confidential_ww222111.png

     

    1) My example screen simply shows which products are sold for each Sales ID. The Product section is not user-friendly as it just lists the items in text format.

     

    -The "price of each item" section displays the price of each item in the order they were sold. This data is used as a preliminary step to calculate the sum. Since the information about the sold items is already available on your screen, it seems unnecessary to recheck the 'ACGH Sales Tracking'.

     

     Concat(Split(subtitle_SelectedItems.Text,Char(10)), LookUp('ACGH Product Details', Title = Value, ProductPrice) & Char(10))   // subtitle_SelectedItems.Text" is the blue multi-line textbox and its text property is 
      Concat(Split(subtitle_SelectedItems.Text,Char(10)), LookUp(ProductDetails_DEMO, Title = Value, ProductPrice) & Char(10)), 

    char(10) represents a line break character.

     

      

    -The "sum of total" section shows the total price of the products.


    Text(Sum(Split(subtitle_SelectedItems.Text, Char(10)), LookUp('ACGH Product Details', Title = Value, ProductPrice) ), "[$-en-US]$#,###.00")    

     

    2) 2nd option is... When selecting a single record from the sales history list, it is possible to perform the following actions within the OnSelect event. ThisItem.Product contains the products that were sold. By using ForAll, you can obtain the price for each respective product.

     

    ForAll(ThisItem.Product, //Loop through the list of products that a customer selected (Max.3 in your example)

    Collect(colSelectedProducts, //Create a collection to manage items and calculate total price
    {Product:Value, //takes the name of each item from ThisItem.Product. e.g)Laptop, Keyboard, Desktop as the customer selected
    ProductPrice:LookUp('ACGH Product Details', Title=Value, ProductPrice)} //Retrieve the price info from the SPO list
    )
    );

    3)As the collection contains prices for sold products, the following code is used to calculate the sum
    Text(Sum(colSelectedProducts,ProductPrice),"[$-en-US]$#,###.00")

     

     

     

    I hope this helps.

     

    Kirkby

     

    (

    If my response has been helpful in resolving the issue, I would appreciate it if you could adopt it as the solution.)

  • HM-22080408-0 Profile Picture
    67 on at
    Re: Power Apps Sum Values in Gallery

    Thank You @Kirkby 

    It works! thanks a lot

  • Kirkby Profile Picture
    647 Moderator on at
    Re: Power Apps Sum Values in Gallery

    Hi!

    I am so glad that my answer helped. 🙂 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 836 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 231 Super User 2025 Season 2

Last 30 days Overall leaderboard