I'm sure someone will point out that this is a basic reshaping problem, but I guess I'm poor at Googling, so I'm offering my question up to the gods of Stack Overflow.
My problem is that I want to calculate the number of days between two dates (of Rank 1 and 2) that come from the same column but have different values in another column (Rank). Here's an example of the dataset schema:
User Date Rank
Bob 2016-12-01 3
Bob 2016-12-07 2
Bob 2016-12-10 1
What I would like is this:
User Date1 Date2 DaysBetween
Bob 2016-12-07 2016-12-10 3
Ideally, I wanted to do this in Tableau, but SQL/BigQuery is OK, too