4 Replies Latest reply: Mar 12, 2018 2:38 PM by Prashant Sangle RSS

    Min() with a date

    Eduardo DImperio

      Hi,

       

      I'm trying to get the min condition date from this table:

       

       

      Set Data=10/02/2018;

      LET Mes=Date(Data,'MM/YYYY');

      For vDias = 0 to 2

           Data=Date(Data-$(vDias));

           Mes=Date(Data,'MM/YYYY');

           For vMeses = 0 to 6

      //***************************************************

      Exibicao:

      LOAD DISTINCT

          OID_METER,

          OID_SYSTEM,

          OID_GROUP,

          NAME_SYSTEM,

          CONS0,

         '$(Data)' AS DATA_EXTRACAO,

         ('$(Mes)') AS MES_ANO_EXTRACAO

      FROM [lib://Dados/MI/Leituras/Consumo/Condominios/FATURA/FATURA_EXIBICAO_$(vCarga).qvd](qvd);

      //***************************************************

           Data=AddMonths(Data,-1);

           Mes=Date(Data,'MM/YYYY');

           Next

      Set Data=10/02/2018;

      Mes=Date(Data,'MM/YYYY');

      Next

       

      So, in chart MES_ANO_EXTRACAO appears ok to me, but when i try  Min(MES_ANO_EXTRACAO) i got null


      set_analysis.JPG