I'm not sure if this can (or should) be built in TSQL. I have built a couple of sales reports which we would want to compare in a few ways. As an example sales volume. Dataset is pretty straightforward. There's a shared key - though there may not be a match across both datasets - and some numerical value.
I know how to do this as a one-off for one dataset. Create a new TVF, call the original datasets, make comparisons & output comparisons. Is there a way to do this with arbitrary datasets? IE I won't know how many columns, what they are called etc. But I would like the average of those datasets.
If not, I know I can do it in Python, but was hoping to keep it all in the same place. Thanks!
Example Dataset #1
Example Dataset #2