Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ppviboud
Contributor
Contributor

Problem with Set Analysis

Hola,
Estoy teniendo un problema con un set analisis.
Quiero calcular el mes anterior de un campo. Mi fecha es formato YYYY-MM y el campo es "Periodo". 

sum( {$<Periodo={"<=$(=date(Periodo-1))>"}>}  CampoASumar)

Alguien me puede corregir esto? 

Gracias.

 

Labels (3)
4 Replies
Taoufiq_Zarra

create variable

Periodo_new =

=Makedate(Year(Date#(Periodo,'YYYY-MM')),Month(Date#(Periodo,'YYYY-MM')),1)

Capture.PNG

then the New Set analysis :

sum( {$<Periodo_new={"<=$(=Addmonths(Periodo_new,-1))>"}>} CampoASumar)

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
ppviboud
Contributor
Contributor
Author

Hi, thanks for the quick answer. 
I tried what you said, but its giving me back the value of the current month, not the value of the month before. 

Taoufiq_Zarra

ah ok

may be

 

=Sum({<Periodo_new= {"$(=Addmonths(Periodo_new,-1))"}>} CampoASumar)

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Kushal_Chawda

may be this

 

sum( {$<Periodo={"<=$(=date(addmonths(max(Periodo),-1),'YYYY-MM'))>"}>}  CampoASumar)