I have an Incidents SharePoint list where I have Program as a Lookup Field (points to Programs SharePoint List). In Incident list I have Severity as a choice column with: Red, Yellow.
In PowerApps I have A Gallery A which Groups the Incident list items by Program. So, Gallery A is a List of Programs that have active incidents. I have a nested sub-Gallery B inside Gallery A. Sub-Gallery B lists incidents in the particular Program. In sub-Gallery B items I have color circles indicating the incident severity.
My problem is: I would like to have a color square for Gallery A items (Programs) so that it's defined by the worst severity in the sub-Gallery B items: If there are any red ones, the whole Program is red, otherwise yellow. And I want also to sort the Gallery A by Programs' severity.
I have tried to set a variable for that but with no success. It's difficult to know, where i should define the variable, and would it be with an if condition.
Any ideas?