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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources 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
Partner - Creator

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