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 / Pulling Sub totals fro...
Power Apps
Answered

Pulling Sub totals from a Gallery

(0) ShareShare
ReportReport
Posted on by 239

Hi, 

 

I am trying to get sub totals for the items in my Expense Gallery. 

 

 

Sum(GalleryExpenses.AllItems, Filter ('Exp Category' "Meal", GalCost))

 

 Travel App Expenses Sub.png

 

Categories:
  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Just needs to be the column you want to reference.

     

    Sum(GalleryExpenses.AllItems, galcost)

     

    If there are multiple columns you wish to add then you would write:

    Sum(GalleryExpenses.AllItems, "Meal" + GalCost))

     

  • GF-02121351-0 Profile Picture
    239 on at

    @KRider that would work if I wanted all items, but I am trying to do sub totals by category. 

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Right, then you would filter the gallery itself first? or no can do?

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Try this one out.

    Sum(GalleryExpenses.AllItems, If(ThisRecord.Category="Meal",Galcost))
  • GF-02121351-0 Profile Picture
    239 on at
    Sum(GalleryExpenses.AllItems, "Meal" + GalCost))

    When I tried this it gave me the total of all items. 

     

    Sum(GalleryExpenses.AllItems, If(ThisRecord.Category="Meal",Galcost))

    For this one I get an "Incompatible types error. These types cannot be compared. Error: Text" 

  • Verified answer
    KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Ok, for your table is the category Column named Category? Thats what we are referencing here. 

     

    Sum(GalleryExpenses.AllItems, If(ThisRecord.CategoryCOLUMN=(Whatevercategory you want), Galcost))

     

    You could also create a drop down of your categories and make the code like this:

    Sum(GalleryExpenses.AllItems, If(ThisRecord.Category=DropDown1.Selected.Value,Galcost))
  • GF-02121351-0 Profile Picture
    239 on at

    That is where I messed up. I called it Exp Category. 

     

    Thank you, I am all set. 

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    No problem! 😄 

  • yirga Profile Picture
    6 on at

    Is there a way to implement Totals and and Subtotals in a Gallery without repeating Header? Example: In a Department there 20 offices, in each office there are at least 3 Programs, and in each program there are at least 2 sub-Programs. So, is there a way to calculate subtotals of Sub-Programs, Sub-Totals of Sub-Programs, and so on.. Within a Gallery? Thanks!

  • GF-02121351-0 Profile Picture
    239 on at

    Hi Yirga, 

    In your dataset what are your column headings? Do you have one entry per program? 

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard