Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

eduardo_dimperi
Valued Contributor II

Min() with a date

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

Tags (1)
1 Solution

Accepted Solutions
eduardo_dimperi
Valued Contributor II

Re: Min() with a date

Hi,

with this code it works

Exibicao:

LOAD DISTINCT

    OID_METER,

    OID_SYSTEM,

    OID_GROUP,

    NAME_SYSTEM,

    CONS0,

'$(Data)' AS DATA_EXTRACAO,

  DATE(DATE#('$(Mes)','MM/YYYY'),'MM/YYYY') AS MES_ANO_EXTRACAO

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

4 Replies
eduardo_dimperi
Valued Contributor II

Re: Min() with a date

Hi,

with this code it works

Exibicao:

LOAD DISTINCT

    OID_METER,

    OID_SYSTEM,

    OID_GROUP,

    NAME_SYSTEM,

    CONS0,

'$(Data)' AS DATA_EXTRACAO,

  DATE(DATE#('$(Mes)','MM/YYYY'),'MM/YYYY') AS MES_ANO_EXTRACAO

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

Re: Min() with a date

please closed the thread if you get the answer.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
eduardo_dimperi
Valued Contributor II

Re: Min() with a date

I think better exclude the question instead mark right answer to myself

Re: Min() with a date

mark your answer correct , because it will help other qliker to find solution.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Community Browser