Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
rajtechnocraft
Creator
Creator

Current value/previous value thru set analysis help required

Hi Experts, Just wanted help in calculating previous value. I am having sum of sales as my expression It will always show me current value What i want to do is add one more expression which is previous sales . I don't want to do this at script level but at frontend using set analysis The calculation of current /previous value will be based on date selection. Ex if i select today's date then previous should show me yesterdays sale. Pls help. Regards Raj

2 Replies
SunilChauhan
Champion II
Champion II

load

Year ,

peek(Year ) a previous

sales

from path;

in expression

sum({<Year={$(=Only(Year)}>} sales) - current value

sum({<Year={$(=Only(previous)}>} sales) -previous valuee

or

tab1:

Load

Year,

sales

from path

let var=peek('fieldname',-1,Tablename);

in expression

sum({<Year={$(=Only(Year)}>} sales) - current value

sum({<Year={$(var}>} sales) -previous value

hope this helps

Sunil Chauhan
SunilChauhan
Champion II
Champion II

use this for previous calculattion

=sum({<Day= {'$(=Date(max({<Day = {"<$(=max(Day))"}> } Day)))'}>}  Price)


Sunil Chauhan