Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Ribeiro
Specialist
Specialist

Setting the previous year in set analysis

I need to go back the previous year in the variable?

vMesAtual = Makedate(year(today()),month(today()),25);

vMesAnt = Makedate(year(today()-30),month(today()-30),25);


I need to fix the variable to bring 12/25/2017 = vMesAnt

But the variable must always be on the 25th of every month

2018-01-15_10-09-59.png

Example:

vMesAnt :  25/12/2017

vMesAtual: 25/01/2018

any suggestion?

Neves
1 Solution

Accepted Solutions
sunny_talwar

Oh, you want to go just one month back? Try this

vMesAnt = AddMonths(MakeDate(Year(Today()), Month(Today()), 25), -1);

View solution in original post

9 Replies
sunny_talwar

May be this

vMesAtual = MakeDate((Year(Today()) - 1), Month(Today()), 25);

or

vMesAtual = MakeDate(Year(AddYears(Today(), -1)), Month(Today()), 25);

PrashantSangle

Use addYear(YourExpression,-1)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Ribeiro
Specialist
Specialist
Author

If the date is 2/25/2018 and 1/25/2018 will it work?

Neves
sunny_talwar

Oh, you want to go just one month back? Try this

vMesAnt = AddMonths(MakeDate(Year(Today()), Month(Today()), 25), -1);

YoussefBelloum
Champion
Champion

Hi, try this


vMesAnt = Makedate(AddYears(today(),-1),month(today()-30),25);

Ribeiro
Specialist
Specialist
Author

Thanks for your patience and competence.

Neves
Ribeiro
Specialist
Specialist
Author

Sunny will be that the set analys is correct?

It is not bringing values...

vMesAtual = Makedate(year(today()),month(today()),25);

vMesAnt = AddMonths(MakeDate(Year(Today()), Month(Today()), 25), -1);

Sum({$<Ano =,Mes=,Date1 = {">= $(vMesAnt) <= $(vMesAtual)"},

[Movimento_Tipo_Operacao]={'DEV','VND','VPC','VEF','ACE','FPV','CVE'},[Dt_Passou1]={'0'} >}Preco_Final)

Neves
sunny_talwar

Don't add spaces and then try this

Sum({$<Ano =,Mes=,Date1 = {">=$(=vMesAnt)<=$(=vMesAtual)"},

[Movimento_Tipo_Operacao]={'DEV','VND','VPC','VEF','ACE','FPV','CVE'},[Dt_Passou1]={'0'} >}Preco_Final)

or this

Sum({$<Ano =,Mes=,Date1 = {">=$(=$(vMesAnt))<=$(=$(vMesAtual))"},

[Movimento_Tipo_Operacao]={'DEV','VND','VPC','VEF','ACE','FPV','CVE'},[Dt_Passou1]={'0'} >}Preco_Final)

Ribeiro
Specialist
Specialist
Author

Sum({$<Ano =,Mes=,Date1 = {">=$(=vMesAnt)<=$(=vMesAtual)"},

[Movimento_Tipo_Operacao]={'DEV','VND','VPC','VEF','ACE','FPV','CVE'},[Dt_Passou1]={'0'} >}Preco_Final)

Neves