Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I want to compare two years sale ie the current year should be the 2017 and prev year should be either 2016,2015 or any other year less that 2017
so in my script i have declared my variable as :-
Let currentdate =DATE(Today(1)-1,'YYYYMMDD');
Let Curr_Year = Year(Today());
let prev_year=..............
createdate is a column in database
Date#(CreateDate, 'YYYYMMDD') as Sold_Date,
month(Date#(CreateDate, 'YYYYMMDD')) as Sold_Month,
year(Date#(CreateDate, 'YYYYMMDD')) as Sold_Year,
in my expression i have expression for prev_year and curr_year
curr_year expression:-
=num(
sum(if(Sold_Date <= MakeDate(Curr_Year,month(To),day(To)) and Sold_Date >= MakeDate(Curr_Year,month(From),day(From)), [inv value]))/Sales_INR_Unit,
'#,##0.0')
for prev_year
=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')
Now what all changes are required for prev_year expressions? and for prev_year variable declration????????
variable used in text box is working but charts are not showing results, it can be seen in image
Please have a look addyears - script and chart function ‒ Qlik Sense
But how to use this in my script?
Why not like below
LET prev_year= AddYears(Your Intend, -1);
but i think it will give me result as 2016
but i want on input of a year in input box, the chart should start showing the appropriate result
for eg if i input 2015 in input box the results should be shown on chart
True, You can simply the expression like Variable as Input box and call that variable in Front End of each Report until unless it won't. That means little in detail
LET Var = Max(Year);
So, In your list box it has Var as "Used Variables"
And then, the analysis need to be changes as per input from customer. So you have to enable like
Sum({<Year = {$(=Var)}>} Sales) // this deserve, If we add manually input from input box..
Does it make sense..
This is not functioning
i have used
Let Prev_Year = AddYears(Date,2);
Let's consider Date has 12/12/2017, 11/12/2017..
How and Which Date field picks to go backward.. That means, you have to use Max() and Min() to get into work..
Note - If none of them make sense for you i would suggest please come up with example and explain same as needed
now how to use max iand min in sa,me above varialable declaration?
Not sure, Your thread is different and your conclusion is different. May be this?
Let Prev_Max_Year = Date(AddYears(Max(Date),2));
Let Prev_Min_Year = Date(AddYears(Min(Date),2));