Alright, after 3-4 days of trying to solve this I am giving up. I started out with only one table but now I have changed it alot so I am able to have two tables, I thought it would make it alot easier for a rookie like me. See my earlier post here
Instead of posting all the table details here I am providing a screenshot: Tables and expected result
I have managed to come quite far with this but the problem is that I am not able to do the calculations excluding the batches that should not be included.
How could I solve this? I really appreciate the help I get from you guys. Thanks in advance