Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
adrianfer
Contributor III
Contributor III

Calculating Difference from previous year

 

Good day, I need help please in calculating the column 'Difference from Previous Year'. Thank you in advance!

adrianfer_0-1753416386396.png

My data is like this (and also attached):

adrianfer_1-1753416429688.png

 

 

 

 

Labels (2)
1 Solution

Accepted Solutions
anat
Master
Master

data:

load month ,year,count from table;

left join

load addmonths(month,1) as month,

count as pre_count

resident data;

in frontend use the sum(count)-sum(pre_count)

 

use the below for reference:

https://community.qlik.com/t5/App-Development/Previous-month-sales-in-loading-script/td-p/1697294

 

View solution in original post

2 Replies
hanna_choi
Partner - Creator II
Partner - Creator II

Hello @adrianfer 

I solve this issues using "before()" functions.

expression : Sum(Count) - before(Sum(Count))

 

hanna_choi_0-1753417308949.png

 

 

 

anat
Master
Master

data:

load month ,year,count from table;

left join

load addmonths(month,1) as month,

count as pre_count

resident data;

in frontend use the sum(count)-sum(pre_count)

 

use the below for reference:

https://community.qlik.com/t5/App-Development/Previous-month-sales-in-loading-script/td-p/1697294