Hard to understand what you're really looking to do there.
When you have data from a secondary source, you only get one value per primary-source row.
Can you hack up a simple example using two excel sheets as your two data sources so that I can see what you are expecting to do?
(Note to self: V 9.1 workbook)
In Sheet1 I created a calc in the primary source that just grabbed the ATTR() of the secondary date. Because there is a one-to-one correspondence between the two sources, this works. But if you end up with multiple rows in the secondary source -- and especially if you get multiple dates in those multiple rows -- you will want to do a MIN() or MAX() instead of ATTR().
The calc is handled as a MEASURE in the primary source because all data coming from the secondary has to be treated as some sort of an aggregate. (And ATTR() is treated as an aggregate.)
I dragged the calc to the rows shelf, and it automatically went on as a discrete value. (So it's a blue pill on the rows shelf.) I moved that to the front of the list of pills on ROWs, and tableau automatically sorts (ascending -- you don't get a choice here). Then I unchecked "Show header", and the column disappears from view.
That's one way to do this.
I also did it a second way. See sheet2.
I just dragged the date field directly from the secondary source to the rows column. (It defaults to YEAR().)
In sheet3 (which is a duplicate of sheet 2) I changed it to exact date. It looks ugly, but stick with me!
In sheet4 (next copy) I changed it to DISCRETE. Now it's a blue pill again.
In sheet5 I moved it to the front of the ROWs shelf. Now it sorts ascending.
In sheet6 I unclicked "Show Header".
So what if you want to sort DESCENDING? That will be trickier. Tableau just wants to sort aggregate pills like this ascending. Same for calcs and table calcs. If you want descending, we can discuss ideas for that. If ascending is what you need, you're done!
Sample 2.twbx 35.1 KB
This is perfect! Thanks Joe!
I know I'm a few years late but I was wondering if you could share how you would achieve this to sort descending as that is exactly what I'd like to do!
You'd create another calc that does
SORT(attr([whatever field]), 'desc')
And place that as the first pill on ROWS.