9 Replies Latest reply: Jun 2, 2016 6:36 PM by Joris Lansdaal RSS

    Help - last value in a serie of lines

    Joris Lansdaal

      Hi all,

       

      I'm stuck with the following issue. In my datamodel I Have three components that make a stock projection.

      - Demand_Aantal (demand in units)

      - Voorraad (inventory units))

      - Lopend_Aantal_B (Ordered units)

      In the end I need the fact Projectie with only one projection per %BQS_Datum_Key and the other lines get a 0.

      I have the sorting and sum all worked out in Projectie2 (with a rangesum). And with mapping, via below script, i will get what I want. However....I don't know how to get the last line like in the example.

       

      Projectie:

      Mapping

      Load

      BQS_ind&Datum as %BQS_Datum_Key,

      Min(Projectie2) as Projectie

      resident Temp_Projectie_1

      Group by BQS_ind&Datum ;

       

      Demand:

      Load *,

      if(%BQS_Datum_Key=Peek(%BQS_Datum_Key),0,ApplyMap('Projectie',%BQS_Datum_Key,0))as Projectie

      resident Temp_Projectie_1;

      Store Demand into $(vStorePath)\Datamodel_Projection.CSV (txt);

      Projectie.PNG

      Any ideas?