Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to compare the current year with previous year
for example
its booked until 201404
i want t show the sales for sum(maxyear) : Jan/Feb/Mar/Apr 2014
and compare it with sum(sales) : Jan/Feb/Mar/Apr 2013
below thread is based on same, Please follow same. I
Write like below script
If dimension you use Year
Dimension:- Year
Expression for current year:- Sum({<YearField = {'$(=Year(Today()))'}>} sales)
Expression for previous year:- Sum({<YearField = {'$(=Year(Today())-1)'}>} sales)
If You have dimension any Date field
Expression for Current Year:- =SUM({$<DateField = {'>=$(=YearStart(Today()))<=$(=MonthEnd(Today()))'}>}sales)
Expression for Previous Year:- =SUM({$<DateField = {'>=$(=AddMonths(YearStart(Today()),-12))<=$(=AddMonths(MonthEnd (Today()),-12))'}>}sales)
Considering you have Date field in your data model
Current Year
=SUM({$<Date = {'>=$(=YearStart(Today()))<=$(=MonthEnd(Today()))'}>}Sales)
Previous Year
=SUM({$<Date = {'>=$(=YearStart(AddYears(Today(),-1)))<=$(=MonthEnd(AddYears(Today(),-1)))'}>}Sales)
Comparison/Growth you can do as
([Current Year]-[Previous Year])/[Previous Year]
Hope this helps...
Easiest thing to do it? Get your "date" field, and create another two fields in the script:
MONTH(date) as Month,
YEAR(date) as Year
Next step, on your dashboard, create a graphic sum table (you'll see when you choose the graphic type) with eveything you want, if you want to lock the selections for 2013 and 2014, use two expressions, with the set analysis (friends have already answered that part).
My tip: just do a normal sum(sales). Create two lists, one with month and one with year, and in their properties, in the "Presentation" tab, change the selection style to "LED check boxes". Those are user friendly.
Whenever they pick 2013, 2014, 2013 and 2014, it will show the sum(sales) of that range. If they want to see for only one month, etc, etc, this way it will become also possible.
This way you will not need to keep changing for every selection people want.
Regards,
Julio
You may want to take a look at the example application I have uploaded: QlikView App: Set Analysis - Prior Period Comparison
This looks at year on year as well as prior month and month to date comparisons.
Hope it is helpful.
Steve
Hi
what do you mean by yearstart,addyears and monthend??
is this a column name ?
These are Qlik functions. YearStart will return the 1st Jan 00:00:00 for whichever year the date in the parameter is for, so;
=YearStart(today())
Will return;
01/01/2017 00:00:00
The other functions work in a similar way.
Steve
Hi,
This functions yearstart,addyears and monthend Qlik Date functions
YearStart :- This gives Year start date that i 01/01/2017
Addyears :- This adding years to the current year
Monthend :- this gives Monthend date of the Month for current month it is 31/12/2017.
i am using this below expressions i am getting following:-
i am not geeting current sales
Current Year
=SUM({$<Date = {'>=$(=YearStart(Today()))<=$(=MonthEnd(Today()))'}>}Sales)
Previous Year
=SUM({$<Date = {'>=$(=YearStart(AddYears(Today(),-1)))<=$(=MonthEnd(AddYears(Today(),-1)))'}>}Sales)
Comparison/Growth you can do as
([Current Year]-[Previous Year])/[Previous Year]