8 Replies Latest reply on Jan 23, 2019 10:19 PM by Prasanna R

    How to Find First Occurrence of String

    scott.mccarthy.1

      I am trying to isolate the first occurrence of product use for a specific product, and then find the date difference between that first occurrence and when the account was created.

       

      [Product_Name]='B'

       

      [Product_Use_Date]

       

      [Account_Created_Date] =7/1/2018 5:30:20 AM

       

      The problem I have right now is that the raw data can look somewhat like this:

       

      [Product_Name]='A' | [Product_Use_Date]=7/1/2018 12:48:45 PM

      [Product_Name]='B' | | [Product_Use_Date]=7/12/2018 1:11:22 AM

      [Product_Name]='C' | | [Product_Use_Date]=7/10/2018 4:11:22 PM

      [Product_Name]='B' | | [Product_Use_Date]=7/03/2018 6:31:22 PM

       

      Essentially, I still want all uses of Product B but I want to be able to calculate DATEDIFF(Account_Created_Date, MIN_Product_Use_Date) but ensure that the MIN_Product_Use_Date is always pulling Product B.

       

      Best,

       

      Scott