Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have created a variable, which is a sum expression for some generic value set satisfying some condition.(Created using script)[ var1 = sum({$(=if( -- ))}) ]
Now i want to create another variable from this existing variable, for which I want to check one more condtion,
Var2 = $var1(PREVIOUS-YEAR = '2014')
How can I do it??
Hi
Is your variable var1 is a Year field ?
No, its an amount field. Actually var1 shows sum of amount for current year+ previous year + etc..
My requirement is, in my selection if i am selecting current year, i want to set a variable with previous year amount. The name of my selection filter is 'Year'.
Hi Bijoy,
Please read article https://community.qlik.com/blogs/qlikviewdesignblog/2015/10/12/why-is-it-called-set-analysis
I think set analysis can solve your problem.
Regards
Hi
why do not try set analysis in Pivot table ?? Assuming 'Year' for filter field
previous year
sum({<Year={'$(=Year(Today())-1)'}>} Amount)
current year
sum({<Year={'$(=Year(Today()))'}>} Amount)
if you would like save this expressions in a variables ...
LET Vpreviousyear='sum({<Year={'&chr(36) & '(=Year(Today())-1)'}>} Amount)';
LET Vcurrentyear='sum({<Year={'&chr(36) & '(=Year(Today()))'}>} Amount)';
LET Vpreviousyear='=sum({<Year={'&chr(36) & '(=Year(Today())-1)'}>} Amount)';
LET Vcurrentyear='=sum({<Year={'&chr(36) & '(=Year(Today()))'}>} Amount)';
try adding equal in your variable.
Actually the amount field in the above statement is another variable in my case "$(Var_MIS_RoomExpense"??
fabs({<[SCENARIO.COD_SCENARIO] = {=$(Year_CurrentMIS)}>}{$(Var_MIS_RoomExpense)})
fabs({<[SCENARIO.COD_SCENARIO] = {=$(Year_CurrentMIS)}>}{$(Var_MIS_RoomExpense)})
it is not working for me actually
Are you looking for something like this:
http://www.quickintelligence.co.uk/variables-parameters-load-script/
It is extremely hard to answer a question like this without any data.
Can you please provide a small sample app file and explain what result you expect to see in the app object?