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 / GroupBy Gallery showin...
Power Apps
Unanswered

GroupBy Gallery showing wrong numbers until data refreshed

(0) ShareShare
ReportReport
Posted on by 725

Hi all

In the home stretch of finishing my current app, but what I am finding is my Gallery is showing the wrong totals until I hit refresh, I will be accumulating a lot of records and I was hoping not to be refreshing data too often. This is the Gallery that's showing the wrong totals.

AddColumns(
 SortByColumns(
 Filter(
 GroupBy(
 Sanford_Pallet_Serial_Number_Record,
 "DateOfProduction",
 "SNDumped",
 "SNGroup",
 "PalletNumber",
 "OPProductCode",
 "DataPool"
 ),
 DateOfProduction >= DatePicker01_1.SelectedDate && DateOfProduction <= DatePicker02_1.SelectedDate
 ),
 LabelSwitchCode.Text,
 Descending
 ),
 "ItemCount",
 CountRows(DataPool),
 "FSNumber",
 First(DataPool).SerialNP,
 "LSNumber",
 Last(DataPool).SerialNP

Which gets fed from this.

UpdateContext({loadSpinner:true}); ClearCollect(GeneratedSNumbers, GalleryNumsGen.AllItems);ForAll(GeneratedSNumbers,Patch(Sanford_Pallet_Serial_Number_Record,Defaults(Sanford_Pallet_Serial_Number_Record),{SerialNP:GalGSNumbers.Text,LotNumber:TILLotNumberFull.Text,DateOfProduction: Now(),OPProductCode:GalleryOpCode.Selected.Value,SFProductCode:LabelSFCode.Text,SNGroup:LabelSFGrade.Text}));UpdateContext({loadSpinner:false})

 Which gets it's sequence from here.

Sequence(Value(TIQtyGenerated.Text),Value(FSNumber.Text))

 Clear as custard I'm sure.

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Corissandageri 

    I cannot tell from your formulas, but what is Sanford_Pallet_Serial_Number_Record?  Is that your datasource or is it a collection or variable?

    If you are working directly with the datasource in all places (filters, patches, etc) then your Gallery will refresh the groupby information automatically.  If you are working with collections or variables, they are only snapshots in time and will need to be updated.  This is not to say that you have to refresh the datasource (as PowerApps will already have the refreshed information when you patch), but you would have to refresh your collections or variables as they are static.

     

    I hope this is helpful for you.

  • R Bakker Profile Picture
    725 on at

    Hi Randy

    Sorry for the delayed reply, I have been trying to work it out myself. Sanford_Pallet_Serial_Number_Record is the datasource. It would seem the actual data is correct because I have a separate gallery showing the data. But it does not seem to count rows reliably.

    AddColumns(
     SortByColumns(
     Filter(
     GroupBy(
     Sanford_Pallet_Serial_Number_Record,
     "DateOfProduction",
     "SNDumped",
     "SNGroup",
     "PalletNumber",
     "OPProductCode",
     "DataPool"
     ),
     DateOfProduction >= DatePicker01_1.SelectedDate && DateOfProduction <= DatePicker02_1.SelectedDate
     ),
     LabelSwitchCode.Text,
     Descending
     ),
     "ItemCount",
     CountRows(DataPool)
     
    )

    When I change what I filter by(LabelSwitchCode.Text), it corrects itself.

  • R Bakker Profile Picture
    725 on at

    I have moved the filter, but that has not improved the countrows reliability

    AddColumns(
     SortByColumns(
     GroupBy(
     Filter( Sanford_Pallet_Serial_Number_Record, 
    DateOfProduction >= DatePicker01_1.SelectedDate && DateOfProduction <= DatePicker02_1.SelectedDate),
     "DateOfProduction",
     "SNDumped",
     "SNGroup",
     "PalletNumber",
     "OPProductCode",
     "DataPool"
     ),
    
     LabelSwitchCode.Text,
     Descending
     ),
     "ItemCount",
     CountRows(DataPool)
     
    )

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,070

#2
Valantis Profile Picture

Valantis 639

#3
11manish Profile Picture

11manish 608

Last 30 days Overall leaderboard