Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Ajuda com variáveis

Alguém poderia me ajudar a fazer a seguinte expressão no Qlik?

IF @MESANT = 1

   BEGIN

      SET @MESANT = 12

      SET @ANOANT = DATEPART(YEAR,GETDATE()) - 1

   END

ELSE

   BEGIN

      SET @MESANT = @MESANT - 1

      SET @ANOANT = DATEPART(YEAR,GETDATE())   

   END  

Labels (1)
1 Solution

Accepted Solutions
fernando_tonial
Employee
Employee

Olá Lucas, boa noite.

Você pode fazer assim.

IF vMESANT = 1 THEN

      SET vMESANT = 12;

      LET vANOANT = YEAR(Today()) - 1;

ELSE

      LET vMESANT = vMESANT - 1;

      LET vANOANT = YEAR(Today());

END IF

Qlikfique-se.

Tonial.

Don't Worry, be Qlik.

View solution in original post

1 Reply
fernando_tonial
Employee
Employee

Olá Lucas, boa noite.

Você pode fazer assim.

IF vMESANT = 1 THEN

      SET vMESANT = 12;

      LET vANOANT = YEAR(Today()) - 1;

ELSE

      LET vMESANT = vMESANT - 1;

      LET vANOANT = YEAR(Today());

END IF

Qlikfique-se.

Tonial.

Don't Worry, be Qlik.