I have a gallery in Power Apps which pulls data from various Dataverse tables and displays it as text labels within my gallery. The primary category column contains duplicates, but each subcategory can only appear once per primary category.
I wish to assign a number sequence and display it in a text label within each gallery item. The sequence should start counting from 1 and add 1 for each row (i.e. each subcategory) with the same primary category, then start over again from 1 once the primary category changes, and so on.
In the attached picture you can see a very simplified illustration of what I am trying to do. The "sequence" column values are what I want to assign and display within each gallery item row. I have been trying for quite some time to figure out a way to do this, but so far I have not been successful. Any advice?