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: 
Anonymous
Not applicable

sales comparison between any two years

Hi all

I have a query, in my reoprt i have sales comparison on basis of current year (2017)and previous year(2016). Current year is taken as following

current year  and previous year

Let currentdate =DATE(Today(1)-1,'YYYYMMDD');
Let Curr_Year = Year(Today());
Let Prev_Year = (Year(Today())-1);

so, here its working fine but if i want to show a comparison between year 2015 and 2017 and for that i am entering year in (year comparison)previous year as 2015 in input box (attached document ) ,the report is not showing correct results so please help me how can i manage this issue?

How can i define variable (curr year and prvious year) so that my report can be seen for comparison between any two year's sale




thanks in advance


regards

sakshi

4 Replies
justinvchiang
Contributor III
Contributor III

Hi Sakshi,

Do your expressions use your Year variable in set analysis?

e.g. sum({<year = {'$(vYear1)'}>} fact)

That is how you would normally handle this.  See attached sample.

Anonymous
Not applicable
Author

These are my different expressions for different years (above in image)

for 2016 expression (this is the expression)

=num(

sum(if(Sold_Date <= MakeDate(Prev_Year,month(To),day(To)) and Sold_Date >= MakeDate(Prev_Year,month(From),day(From)),  [inv value]))/Sales_INR_Unit,

'#,##0.0')

Anonymous
Not applicable
Author

extraaaa.png

justinvchiang
Contributor III
Contributor III

does your data model have a master calendar table?