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 / Help with sum formula ...
Power Apps
Answered

Help with sum formula for enahnced gallery details

(0) ShareShare
ReportReport
Posted on by 601

I am trying to provide a little bit of "reporting" from my gallery to my users. I've been able to set up dynamic lables which display the total amount, the max amount and the average amount due for all visible items in the gallery. I'd like to take it a step further and display the total amount based on the "Aging Category". In my app we have 6 different aging categories ( "Current," "31-60," "61-90," "91-120," "121-150," "Over 150,") and I would like to display the total balance for each in a dynamic label, just like I was able to do with the totals. I've tried using an If statement to filter based on aging category but I've had no success so far. Do I need to use a collection and group them first?  My formula is a complete mess at this point and definitely doesn't work but below is what it looks like Smiley LOL Thank you for any and all help.

 

Sum(If(AGING_x0020_CATEGORY = "Current", UpdateContext:({TotalCurrent: 'BALANCE AMOUNT'}),'Total Current')

Categories:
I have the same question (0)
  • wyotim Profile Picture
    2,545 on at

    Hey @CarlHRVA, you could use GroupBy and a collection if you like but one technique I like to use is summing directly from the gallery. You can filter the summed items from within the gallery and then any additional filtering trickles down into those sums (if that makes sense). Here's what it looks like (assuming I understand your categories and field names):

    // Put each of these in the text property of a label
    
    // Current amount
    Sum(
     Filter(
     Gallery.AllItems.'BALANCE AMOUNT',
     AGING_x0020_CATEGORY = "Current"
     ),
     'BALANCE AMOUNT'
    )
    
    // 31-60 amount
    Sum(
     Filter(
     Gallery.AllItems.'BALANCE AMOUNT',
     AGING_x0020_CATEGORY = "31-60"
     ),
     'BALANCE AMOUNT'
    )
    
    // 61-90 amount
    Sum(
     Filter(
     Gallery.AllItems.'BALANCE AMOUNT',
     AGING_x0020_CATEGORY = "61-90"
     ),
     'BALANCE AMOUNT'
    )
    
    // ...and so on for each category

    Of course, replace "Gallery" with the name of your gallery and adjust the field names if I didn't get them correct. That should give you a summation of the balance amount for each group in the gallery, which again responds to any filtering applied to that gallery, making for a fairly dynamic experience. Feel free to respond if I need to clarify anything or can try to assist further!

  • CarlHRVA Profile Picture
    601 on at

    @wyotim Thank you so much for your help! I've tried implementing the first formula but still receiving an error... 

     

    Capture.PNG

     

  • CarlHRVA Profile Picture
    601 on at

    This is what the two fields in my gallery that display those items text property looks like...

     

    Capture.PNG

     

    Capture.PNG

  • wyotim Profile Picture
    2,545 on at

    Maybe try the following:

    // Current amount
    Sum(
     Filter(
     Gallery.AllItems.'BALANCE AMOUNT',
     'AGING CATEGORY' = "Current"
     ),
     'BALANCE AMOUNT'
    )  
  • wyotim Profile Picture
    2,545 on at

    Also, make sure you aren't missing a comma after the Gallery.AllItems.'BALANCE AMOUNT' section. It may be looking for an operand due to that.

  • CarlHRVA Profile Picture
    601 on at

    @wyotim Getting closer, thank you so much! I was missing the comma and since the data source is a SharePoint list I opened the list and sorted each column and pulled the column name from there. What I end up with is a formula that is nearly correct but it says the "=" sign is an invalid argument type now?

     

    Capture.PNG

     

  • CarlHRVA Profile Picture
    601 on at

    I've tried using AGING_x0020_CATEGORY.Value and ManagersUIGallery.AGING_x0020_CATEGORY.Value and it doesn't like either of those.

  • wyotim Profile Picture
    2,545 on at

    What data type is AGING_x0020_CATEGORY? Unfortunately, I don't know SharePoint too well (the company I work for uses SQL primarily) but there may be some issue with the type, like if it is a Choice type instead of a text type. I'll look for what that may be real quick.

  • CarlHRVA Profile Picture
    601 on at

    It's a single-line of text column. I tried changing it to a choice column as well but that didn't work and also caused the label in my gallery to slop working as well.

  • wyotim Profile Picture
    2,545 on at

    That is odd. I know that there are/were issues with Choice type columns not being filter-able in PowerApps but I thought text fields would work roughly the same. Perhaps they don't. I will do some more checking to see what I can find.

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 321 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 289 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 200 Super User 2026 Season 1

Last 30 days Overall leaderboard