I am not really sure I understood your question, if you could shows us an example of the data or simulate some data to explain us I think it would me easier to understand what you are trying to accomplish, but I would guess that Set Analysis is what you are looking for.
Here is an article for Set Analysis that can maybe help you:
https://support.qlik.com/articles/000025044
To help users find verified answers, please don't forget to mark a correct resolution or answer to your problem or question as correct.