Showing results for 
Search instead for 
Did you mean: 
Not applicable

Gallery repeating objects (with rather unique/peculiar data structure)

I appreciate that there are several queries of this type, but unfortunately none of them solve my particular issue as far as I can tell. 


Apologies for the lengthy description-I just want to be clear on what's going wrong. 


I have a collection, Col_CostAnalCompare_Test, which pulls in all data from a static Excel table, CostAnal, when my app starts. The relevant material is attached. 


A separate collection, Col_UserCompare, also pulls in data from a static Excel table, Benchmark_Test, when the user selects a project that they are interested in comparing (see the 'value_if_false' argument in the if statement below). 



If(ThisItem.Description exactin Col_UserCompare.Description, Remove( Col_UserCompare,
Filter( Col_UserCompare, Description=ThisItem.Description ) ) 

        Description: Description,
        Project_Sum: Project_Sum,
        Quality_Rating: Quality_Rating,




Benchmark_Test and CostAnal are 2 separate tables, but they each feature a column with a Project_ID.  So the Project_ID 'T_DL_1' from Benchmark_Test (and therefore Col_UserCompare) will match a Project_ID from CostAnal (and therefore Col_CostAnalCompare_Test). 


If the user has selected a project to compare, then the following code looks at Col_CostAnalCompare_Test and presents all records  (there are multiple cost entries per project in Col_CostAnalCompare_Test, see the excel for details) where the Project_ID matches the Col_UserCompare_Test Project_ID. 




Filter(Col_CostAnalCompare_Test,Project_ID exactin Col_UserCompare.Project_ID)




Still with me? Hold tight. 


The above code is entered into a gallery, under 'Items'. BUT the actual cost data, derived from Col_CostAnalCompare_Test, is displayed in a subgallery (I tried multiple ways of doing this and this was the only one that permitted scrolling from left to right). 


So you have a gallery with multiple subgalleries. Each subgallery contains cost data. 


But...the subgalleries repeat, seemingly infinitely, within the main gallery. See the attached screenshot. T_DL_1 is shown on the left, followed by T_DL_2 (this is fine, as these are 2 separate projects). But then, as the user scrolls right, T_DL_1 appears again, followed by T_DL_2, followed by get the idea. 


Why is this? I tried to implement the 

Last(FirstN(source, number)) solution that I saw elsewhere (yes, I've searched for a fix pretty hard) but I am not sure my own situation is compatible with this. 


Apologies if any of the above is irrelevant to the repeating gallery situation, but I just wanted to give some context in case it's important. 


Any assistance would be much appreciated. 

Community Support
Community Support

Do you mean that Col_UserCompare has duplicate data?

Actually, I think what you described is a little complex, so I couldn't quite understand the process.

Could you show me

1)the formula that how do you update Col_UserCompare collection?

2)the items property of the gallery?

You just need to tell me the related information about your issue, no need to describe so detailed.

I suggest you firstly describe how this function works and then show me related formulas.

At last, describe your problem.



Best regards,




Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Not applicable

Hi, sorry for the lack of clarity.


Col_UserCompare does not contain duplicate data. The horizontal gallery displays infinite subgalleries (each of which display data derived ultimately from Col_UserCompare, but I don't think the data is the cause of the issue.



1)the formula that how do you update Col_UserCompare collection?




When the 'Add this project to comparison list' button is selected, the following 'Onselect' code is run.



Collect(Col_UserCompare,Filter(Col_SelectedProjects,ThisItem.Description exactin Description)))​





2)the items property of the gallery?



The 'Items' property of the main gallery is as follows:




Filter(Col_CostAnalCompare_Test,Project_ID exactin Col_UserCompare.Project_ID)



The 'Items' property of the subgallery, nested inside the main gallery, is as follows:








My issue is that the gallery repeats the subgalleries over and over again.


So if Project_1 is contained in the  Col_UserCompare, the main gallery's records show lots of subgalleries, with each subgallery showing the cost records for Project_1.


If Project_1 and Project_2 are contained in Col_UserCompare, then the main gallery displays the subgallery (containing the cost records) for Project_1, then the subgallery for Project_2, then it repeats (Project_1, Project_2,Project_1,Project_2 etc).


I am trying to find a way to eliminate the duplication, so that if Project_1 is contained within Col_UserCompare, then the main gallery should only show 1 subgallery: the cost records for project 1.


Likewise, if Project_1 and Project_2 and contained within Col_UserCompare, then the main gallery should show 2 subgalleries: Project_1 and Project_2.


I note that changing the 'items' property of the main gallery to just Col_CostAnalCompare_Test does not solve the issue described below, since the main gallery repeats the subgalleries just the same. Of course, without the filter, it displays all projects in the Col_CostAnalCompare collection. There are currently 3 projects in this collection, so it repeats Project_1, Project_2,Project_3,Project_1,Project_2, etc. 


I trust this is more helpful than the initial description I gave, but do please let me know if any further info is required.



Helpful resources

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,687)