ClearCollect(GQ1, FirstN(Shuffle(Filter(tbl_Questions, Group.Id = 1)), LookUp(gal_settings.AllItems, ID = 1).ti_amount.Text));
ClearCollect(GQ2, FirstN(Shuffle(Filter(tbl_Questions, Group.Id = 2)), LookUp(gal_settings.AllItems, ID = 2).ti_amount.Text));
ClearCollect(GQ3, FirstN(Shuffle(Filter(tbl_Questions, Group.Id = 3)), LookUp(gal_settings.AllItems, ID = 3).ti_amount.Text));
ClearCollect(GQ4, FirstN(Shuffle(Filter(tbl_Questions, Group.Id = 4)), LookUp(gal_settings.AllItems, ID = 4).ti_amount.Text));
ClearCollect(colQuestions, GQ1, GQ2, GQ3, GQ4);
I have above formula in my PowerApps but it's not dynamic. The number of Groups might increase in future.
How can I re-write this formula to make it dynamic?
There are two galleries, first one is gal_settings (filter) which has names of groups and text input where users put amount of questions they want to retrieve from certain group
and the second gallery is just shows shuffled questions from collection