Well, the solution I gave above does not seem to be working in this scenario. So, here is another solution in which I am doing a union of the data with itself. And the results look correct even when the data is filtered.
Hope this helps.
This is a great solution. Thank you for all the help. You have a wonderful weekend!
You are welcome.