Time to Purchase - Tableau

Hi all,

We’re trying to display and calculate the average time to purchase from performing a certain action/event, or from their first visit, in Tableau (connected directly to Redshift).

I have tried to make a calculation of the first interaction, then subtracting it from the order date by doing the following:

First interaction
MIN(DATETRUNC(‘day’,[Derived Tstamp]))

Order date
if [Event] = ‘tr_orderid’ then DATE([Derived Tstamp]) END

Then doing -
DATEDIFF(“day”, [First Interaction],MAX([Order Date]))

However this just gives me null values, so I have obviously got my calculations off. I would also like to do the same date-difference calculations after performing a certain event/action, which the above calculations (if it worked) would calculate from the very first touch-point on the site, rather than from a certain event.

If there are any analysts or data model-ers out there who are familiar enough to help me with this I would massively appreciate it!

Thanks!