If you would like to find the difference between the dates in two different columns (for example when a lead was created and when it was closed as a sale), you can the JULIANDAY function with SQL. The JULIANDAY function essentially puts the date in a format that will allow me to subtract the number of days between two dates.
Use the following code in a SQL transform:
JULIANDAY([DateField2]) - JULIANDAY([DateField1]) AS `New Column Name`
Press the connect button, and you’ll see that now you have a calculated difference between the two date fields.