Your requirement isn’t very clear but give this a go and see if it gets you there:
I started with the 2 tables you’ve described, both have 1 column called “Value”.
Thanks for the answerer, I am also trying to use Earlier but getting some error .
Just one question how your earlier function get the context of table1.