When Creating Custom entity, how do you filter?

Creating a custom entity where I would need to filter for records where Item Group is Group A, Group B, and Group D (for example). But how do I do this in visual studio/x++? Is it via a class or a method?

Taking as someone who is not a developer but my hands get dirty from time to time…

You would override the postLoad method in an entity extension to filter records, using a container to check if ItemGroupId is in the allowed list (GroupA, GroupB, GroupD) and skip non-matching records.
Or you could add a query range on ItemGroupId to filter at the database level

However…I would think it would be better to return all the data and filter downstream. Keeps the entity count down and saves on additional work later.