Hi @ayattaw
To filter your gallery based on multiple selections from a ComboBox, ensuring all selected criteria are met, you can use a combination of the ForAll and CountIf functions. This approach ensures that the gallery only shows items where all ComboBox selections return true.
First, I changed the items property of your ComboBox to ensure it's filtering correctly from 'List A', excluding archived items and optionally showing all options. The new Items property for the ComboBox is:
Distinct(Filter('List A', 'Archived?'.Value ="No" && ('Dropdown1'.Selected.Value="All Options" || 'Dropdown1'.Selected in ColumnX)), Title)
This change ensures that your ComboBox only displays active, relevant items from 'List A'.
Now, for your gallery, use the following formula in the Items property to filter 'List B' based on the selected items in the ComboBox:
Filter(
'List B',
Status.Value = "Approved" &&
ForAll(
'Selection ComboBox'.SelectedItems,
CountIf('List B', 'Column1'.Value = ThisRecord.Value) > 0
)
)
This formula works as follows:
- It filters 'List B' to only include items where the status is "Approved".
- It uses ForAll to iterate over each selected item in the ComboBox.
- The CountIf function checks that for each selected item in the ComboBox, there is a corresponding item in 'List B' where 'Column1' matches. This ensures that the item meets all the selected criteria.
Now, if your dataset its large you are going to have some delegations problems with the filter, and forall functions, please consider to import your data into a collection first and then apply the forumula to your collection, that should fix any delegation issue.
If my response resolved your issue, please feel free to mark it as the solution by clicking accept it as a solution.
This helps others find the answer more easily.
If you liked my solution, please give it a thumbs up.
would be greatly appreciated. Thank you!
Connect with me: LinkedIn