2 Replies Latest reply: Jul 6, 2016 5:33 AM by fredrik olsson RSS

    Add flag to first nested item

    fredrik olsson

      Hi,

       

      In my load statement I wanna add a flag on Invoice level if the its the first invoice (based on invoicedate) in every Order.

      Any help would be much appreciated.

       

      Is it possible to do something like:

      if (min(InvoiceDate) ?, 1, 0) as InitialInvoice

       

       

      Order:

      OrderIdCountryCodeRefererTotalOrderDate
      1234SEGOOGLE3302016-01-05
      1235NONEWSLETTER1052016-01-15

       

      Invoice:

      InvoiceIdOrderIdInvoiceDate
      78912342016-01-05
      79012342016-01-07
      7911235
      2016-01-15

       

      Order:

      LOAD OrderId,

          CountryCode,

          Referer,

          Total,

          OrderDate

       

      Invoice:

      LOAD InvoiceId,

          OrderId

          InvoiceDate