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 / Bug: Gallery with calc...
Power Apps
Answered

Bug: Gallery with calculated values will lose Selected index when calculated value changes

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Description:
If you create a gallery that includes a calculation of underlying values, then change any of those underlying values, the gallery's Selected item will reset to being the first item in the list.

 

Repro steps:
1) Create TableA_Gallery with an item list from TableA, with Items = AddColumns('TableA', "CalculatedColumn", Sum(LookUp('TableB', TableA_ID = 'TableA'[@ID], NumericValue)))

2)  Create a form (TableB_Form) for editing an item from TableB that is included in the calculations in TableA_Gallery

3)  Select any item in TableA_Gallery other than the first one

4)  Edit the NumericValue field in any row in TableB that is included in the calculations of TableA_Gallery

5)  SubmitForm(TableB_Form)

6) TableA_Gallery Selected item will now be the first item in the list, NOT the item selected in Step 3

Categories:
I have the same question (0)
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

    Based on the Repro steps that you provided, I have made a test, and the issue is confirmed on my side. But I don't think it is a bug.

    When you modify NumericValue value in any record of your TableB data source, the TableB data source would be updated. So the result the AddColumns formula returned would also be updated, that means your Gallery control would also be refreshed. In default, the first item of the Gallery control would be selected.

     

    If you want to not change the selected item within the Gallery control when you modify the NumericValue field in any row in your TableB data source, please take a try with the following workaround:5.JPG

     

    6.JPG

    Set the OnSelect property of the Gallery control or the Navigate icon ( ">") button within the Gallery control to following formula:

    Set(CurrentSelectItem,ThisItem)

    Set the Default property of the Gallery control to following formula:

    CurrentSelectItem

    Set the TemplateFill property of the Gallery control to following:

    If(ThisItem.ID=CurrentSelectItem.ID,RGBA( 255, 105, 180, 1 ),RGBA(0, 0, 0, 0))

    The GIF screenshot as below:Test1.gif

     

     

     

    Best regards,

    Kris

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    That does fix the issue, but don't you think it's still a workaround more than the way this is designed to work?  I understand that it's refreshing the original gallery, but don't you think the expected behavior should be to maintain the selected item after refresh in this circumstance?

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

    The result the AddColumns formula returned within the Items property of the Gallery would be refreshed when you change NumericValue field in any row in TableB.

     

    In other words, the Gallery control would be refreshed when you change NumericValue field in any row in TableB, so the selected item would not be maintained.

     

    Best regards,

    Kris

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Where might I log a suggestion for a feature to maintain the selected item on gallery refresh? 🙂

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard