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:
I have the same question (0)
  • 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

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

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard