6 Replies Latest reply: Jul 13, 2013 8:28 AM by Deepak Kumar RSS

    Previous Rate

    Deepak Kumar

      Hi All,

       

      I have one urgent requirement. Requirement is that if Rate of Transport  from 6-7-13 to 13-7-13 is 895 and from 1-7-13 to 5-7-13 is 855.Then I need Previous Rate which is 855. How i find ??

       

       

       

      My code is below:

       

       

      Freight:

      LOAD

       

           FROMDELIVERYPOINTCODE&TODELIVERYPOINTCODE&VEHICLETYPE&Upper(DLVMODEID) as KEY,

           RATE,

           DLVMODEID,

           FROMDELIVERYPOINTCODE,

           TODELIVERYPOINTCODE,

           VEHICLETYPE,

           if(ALE_FREIGHTTYPE=0,'Primary','Secondary') as ALE_FREIGHTTYPE,

       

           date(EFFECTIVEDATETIME) AS StartDate

       

       

      FROM

      D:\QLIKVIEW_RAWDATA\ALE_FREIGHTTABLE.QVD

      (qvd)Where DATAAREAID=100 and YEAR(EFFECTIVEDATETIME)<>1900;

       

       

      Right Join("Freight")

       

      Load

      *,

      Date(if(Previous(KEY) = KEY,date(previous(StartDate)-1),date(Today()))) as EndDate,

      if(KEY=Previous(KEY),Previous(RATE)) as [Previous RATE]

       

       

      Resident Freight //Where num(StartDate)<=Date(if(Previous(KEY) = KEY,date(previous(StartDate)-1),date(Today())))

      Order By KEY,StartDate Desc;

       

       

      Please help me out !!

       

       

      Thanks in advance ..

       

       

       

      Regards

      Deepak