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 Apps - Building 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

 

I have the same question (0)
  • KRider Profile Picture
    577 Super User 2024 Season 1 on at
    Re: Pulling Sub totals from a Gallery

    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
    Re: Pulling Sub totals from a Gallery

    @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
    Re: Pulling Sub totals from a Gallery

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

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at
    Re: Pulling Sub totals from a Gallery

    Try this one out.

    Sum(GalleryExpenses.AllItems, If(ThisRecord.Category="Meal",Galcost))
  • GF-02121351-0 Profile Picture
    239 on at
    Re: Pulling Sub totals from a Gallery
    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
    Re: Pulling Sub totals from a Gallery

    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
    Re: Pulling Sub totals from a Gallery

    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
    Re: Pulling Sub totals from a Gallery

    No problem! 😄 

  • yirga Profile Picture
    6 on at
    Re: Pulling Sub totals from a Gallery

    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
    Re: Pulling Sub totals from a Gallery

    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

Coming soon: forum hierarchy changes

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 314 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 253 Super User 2025 Season 2

Last 30 days Overall leaderboard