Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Running Total in Filtered Gallery

(0) ShareShare
ReportReport
Posted on by 583
I have a gallery called Gallery2 that is filtered by some DatePickers and a Variable that outputs different text. I need to have a running total in that gallery but I cannot seem to make it work. The gallery is filtered like this. (Courtesy of the great Warren Belz!)
 
Filter(
   'SPList',
   (
      Value(DatePicker2_1.SelectedDate) < 1 ||
      DateStarted >= DatePicker2_1.SelectedDate
   ) &&
   (
      Value(DatePicker2.SelectedDate) < 1 ||
      DateEnded <= DatePicker2.SelectedDate
   ) &&
   (
      Len(varLine) = 0 ||
      Line = varLine
   )
)
 
I then need the running total inside Gallery2. Does anybody have an idea on how I can do this? I tried something like this.
Sum(Filter(Gallery2.Selected.ReoveredHours, SPList.ID>=ThisItem.ID),RecoveredHours)
 
Edit: I am also trying to avoid delegation warnings in this app as well.
 
I keep running into errors and cannot seem to figure this one out though. Any help would be appreciated.
Categories:
  • StephenGW Profile Picture
    StephenGW 583 on at
    Running Total in Filtered Gallery
    Thank you again Warren for a great answer and explanation!
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 145,434 on at
    Running Total in Filtered Gallery
    Hi StephenGW ,
    This should work on a label in a gallery but bear in mind the output of the top filter still needs to be under your Data Row Limit to receive the full total. Also it could be a lot of API calls and may be slow.
    With(
       {
          _Data:
          Filter(
             'SPList',
             (
                Value(DatePicker2_1.SelectedDate) < 1 ||
                DateStarted >= DatePicker2_1.SelectedDate
             ) &&
             (
                Value(DatePicker2.SelectedDate) < 1 ||
                DateEnded <= DatePicker2.SelectedDate
             ) &&
             (
                Len(varLine) = 0 ||
                Line = varLine
             )
          )
       },
       Sum(
          Filter(
             _Data,
             ID >= ThisItem.ID
          ),
          RecoveredHours
       )
    )

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard