3 Replies Latest reply: Oct 2, 2018 2:39 AM by Daniel Sørensen RSS

    Count days between - MinDate/MaxDate (Load script)

    Daniel Sørensen

      HI

       

      Can anyone help me figure out how to get a MinDate and a MaxDate. Then count the days between, and assosiate with the column MeterNO

       

      DaysWithZero:
      LOAD
          MeterNO,
          Date("StatusDate") as StatusDate
      FROM [lib://Desktop/ZeroConsumption.xls]
      (biff, embedded labels, table is Export$);
      
      
      Temp2: 
      Load
       MeterNO,
          StatusDato,
          Min(StatusDate) - Max(StatusDate) as DaysWithZero     
      Resident DaysWithZero;
      
      
      Drop Table DaysWithZero;
      
      

       

      I have one table "ZeroConsumption.xls"

      MeterNoStatusDate
      11122233301/01/2018
      111222333
      05/01/2018
      111222333
      07/01/2018

       

       

      I want a table with MeterNo,DaysBetweenStatusDate. (min/max dates)

       

      In this case

      MeterNoDaysBetweenMin/Max
      1112223336