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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
ecabanas
Creator II
Creator II

Comparison year Vs year before

I'm using this function to calculate the revenues for present year

=num(Sum({<[YEAR]={$(VYear)}>} Amount))

I would like to know the same but the year before, I put -1 in the variable but it doesn't work, anybody knows why?

=num(Sum({<[YEAR]={$(=(VYear)-1)}>} Amount))

Thank's for your help

Labels (1)
1 Solution

Accepted Solutions
sujeetsingh
Master III
Master III

Hi if you are using Master Calender  than use following set equation

sum( {$<Year = {$(vLastYear)}>} Sales )

View solution in original post

7 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Can you tell me what is there in VYear?

MayilVahanan
MVP
MVP

HI

Try like this

=Sum({<Year = {'$(=max(Year)-1)'}>}Sales) for maximum -1 year

=Sum({<Year = {'$(=max(Year))'}>}Sales) for maximum year

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
ecabanas
Creator II
Creator II
Author

VYear is a variable: =(year)

ecabanas
Creator II
Creator II
Author

Doesn't work Mayil...

sujeetsingh
Master III
Master III

Hi if you are using Master Calender  than use following set equation

sum( {$<Year = {$(vLastYear)}>} Sales )

nirav_bhimani
Partner - Specialist
Partner - Specialist

HI,

U can try this. Its working

( sum({<FinancialYear = {"$(=Max(FinancialYear))"}  >}Sales) )

-

( sum({<FinancialYear = {"$(=Max(FinancialYear)-1)"}  >}Sales) )

Regards,

Nirav Bhimani

ecabanas
Creator II
Creator II
Author

Now it works!!! I load Master Calendar and now it works perfectly

thank you everyone!!!