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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Modern Table - Calcula...
Power Apps
Answered

Modern Table - Calculating a total

(0) ShareShare
ReportReport
Posted on by 35
Hi,
I am building an app using the Modern Table and at the bottom of the table I would like to show sub totals based on the applied filter.
So for example, I have several columns in the table and if I filter on the materials activity column I would like a subtotal of the Material Cost column, or if I filter on the labour column I would like a subtotal of the Labour Cost column.
 
Can anyone advise how to achieve this please as I thought it would have been the same as you would do for a gallery but that does not seem to work.
 
Thanks in advance
Phil
 
Categories:
I have the same question (0)
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    You might want to use some tricky for that.
    For example, use an invisible gallery in the same screen or a hide screen,
    assign the filtered record to the gallery,
    let the title = the column you want to have a subtotal,
    then you can sum the values that you want. ( beware of the delegation), 
    then add a label for example , text =Text(Sum(Gallery1.AllItems,QtyOrdered))
  • Phil2222 Profile Picture
    35 on at
    @stampcoin, thanks for your response.
    I'm thinking that if I have to create and hide a gallery to achieve a column total sum in a modern table then I just as well use a gallery in the first instance rather than a modern table.
     
    Thanks
    Phil
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    It's an example, Gallery is just a host, this (host) is what you need, you can create a collection which host your filter result.
    and then calculate the total, I hope that make sense.
    Another example.
    Collect(mycollection,
    Filter(PurchaseList,ID<40)) //I put the delegation aside for now.
    
    // assign sum value to a label text
    Text(Sum(ShowColumns(mycol,QtyOrdered),field_Name))
     
  • Phil2222 Profile Picture
    35 on at
    @stampcoin thanks again, but if using a collection where would I use that code to create collection?
  • Verified answer
    stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    How do you filter the data ? 
    For example if you have a button, you can add extra code to collect your filter result .
     
    ClearCollect(
        myPO,
        Filter(
            PurchaseList,
            Supplier= "ABC" // you can use dropdown, combox for this
        )
    )
    Then add a label for subtotal of your column.
     
    Text(
        Sum(
            ShowColumns(
                myPO,
                QtyOrdered
            ),
            field_Name//your table's column field name. field_5 e.g
        )
    )
    hope that make sense to you.
  • Phil2222 Profile Picture
    35 on at
    @stampcoin, I don't actually have a button so use the Screens OnVisible property to do this and it seems to be working.
     
    Thanks
    Phil

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 740 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 342 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard