Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for Data Integration and Data Analytics gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

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
Highlighted
Contributor III
Contributor III

Re: sales comparison between any two years

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.

Highlighted
Creator II
Creator II

Re: sales comparison between any two years

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')

Highlighted
Creator II
Creator II

Re: sales comparison between any two years

extraaaa.png

Highlighted
Contributor III
Contributor III

Re: sales comparison between any two years

does your data model have a master calendar table?