Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our May 2021 end-to-end product release from Data Integration to Data Analytics is out! READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Amberj_29
Contributor III
Contributor III

Previous Month vs Previous Month Last Year

Hello All,

 

I'm trying to do a basic thing, but I cannot work it out. I can do current month vs current month last year, but when I try to do this for Previous month vs previous month last year it doesn't work. I am trying to work out percentage difference

Here is my attempt:

((sum({<[Doc Date]={">=$(=MonthStart(AddMonths(Max([Doc Date]),-1)))<=$(=AddMonths(Max([Doc Date]),-1))"}>} [Net Value])) 

/

(Sum({<[Doc Date]={">=$(=AddYears(MonthStart(AddMonths(max([Doc Date])-1)),-1)) <=$(=AddYears(AddMonths(max([Doc Date]),-1))"} >} [Net Value])))-1  

 

This Last section does not work - I try to modify it from the current month vs current month last year but to avail. Please help 🙂

Many thanks,

1 Solution

Accepted Solutions
kaushiknsolanki

Hi,

Change your below expression.

((sum({<[Doc Date]={">=$(=MonthStart(AddMonths(Max([Doc Date]),-1)))<=$(=AddMonths(Max([Doc Date]),-1))"}>} [Net Value])) 

/

(Sum({<[Doc Date]={">=$(=AddYears(MonthStart(AddMonths(max([Doc Date])-1)),-1)) <=$(=AddYears(AddMonths(max([Doc Date]),-1),-1))"} >} [Net Value])))-1

 

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".

View solution in original post

2 Replies
kaushiknsolanki

Hi,

Change your below expression.

((sum({<[Doc Date]={">=$(=MonthStart(AddMonths(Max([Doc Date]),-1)))<=$(=AddMonths(Max([Doc Date]),-1))"}>} [Net Value])) 

/

(Sum({<[Doc Date]={">=$(=AddYears(MonthStart(AddMonths(max([Doc Date])-1)),-1)) <=$(=AddYears(AddMonths(max([Doc Date]),-1),-1))"} >} [Net Value])))-1

 

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".

View solution in original post

Amberj_29
Contributor III
Contributor III
Author

Thank you for your swift response. It works, I just thought I'll add a comment as there was a comma missing 🙂

((sum({<[Doc Date]={">=$(=MonthStart(AddMonths(Max([Doc Date]),-1)))<=$(=AddMonths(Max([Doc Date]),-1))"}>} [Net Value]))
/
(Sum({<[Doc Date]={">=$(=AddYears(MonthStart(AddMonths(max([Doc Date]),-1)),-1)) <=$(=AddYears(AddMonths(max([Doc Date]),-1),-1))"} >} [Net Value])))-1

Many thanks