Hi Nikhil,
You can use the remove method of the collection to hide the entities which you don't want to display.
Now when you want to get all the entities to calculate the value, use the get_related_entities method of the Parent entity ( header in your case ) and get all the values.
I hope it solves your issue.