Hi all,
I have a situation where I have two data sources, Table A and Table B. The only link I have between these two Tables is Customer ID.
In Table A, I have the following:
Customer IDDateValue123401/01/20171123501/02/20171123401/02/20172
In Table B, I have the following:
Customer IDDateValue123401/12/20161123401/04/20171123402/01/20171
What I want is to return only the Values from Table B where the Date is >= MINIMUM Date from Table A (per customer). So for this example above, the minimum date in Table A for customer 1234 is 01/01/2017. The only rows that should be returned are lines 2 and 3 from Table B.
So my output would be like this:
Customer IDSum(Value Table A)Sum(Value Table B)Sum(Value Table A)-Sum(Value Table B)123432112351NULL1
Any help you could provide me with this would be greatly appreciated.
Thanks,
Stefan.
Okay, got it.
Unfortunately, at least as far as I know, there isn't much flexibility to do what you want to do when you data is blended (which is what the orange link icon means). I was able to come up with something that calculates what you're looking for, but it has many shortcomings (you need the individual dates from Table B in your view and you can't pull in values from Table A). I don't think that's what you want.
What you could try, if you're unable to write a custom query and do a join, is use a Union. Tableau let's you create custom unions when setting up a data source. (Table A and Table B below are just different sheets in an excel workbook.)
The data then looks like the following:
If you can do this, achieving your result is actually quite simple. All it requires is a LOD calculation for the min date from Table A ({FIXED [Cust ID] : min([Date1])} and a calculated field to filter out the dates from Table B that are less than that ([Table Name]="Table A" or [Date2] >= [Min Date]).
You then get this as your final result:
Does this help? I've attached a workbook in v10.2. Let me know!
Michael