Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am working with a large data set and am building some analysis expressions to make selections from the data. some of these expressions are getting quite large, I have included an example below (but have deleted a lot of the [Standard Industry Codes] I'm interested in to make it fit on the page!)
=if(rank(if(sum({1<Institution=, [Subject marker]=-{'Other'},[Standard Institution Code]=,Gender=>}Data)>varMinStudents,
sum({1<Institution=,[Subject marker]=-{'Other'},[Standard Institution Code]={
'01 mining',
'02 agriculture',
'05 engineering',
'08 manufacturing',
'13 defence'},Gender=>}Data), / sum({1<Institution=, [Subject marker]=-{'Other'},[Standard Institution Code]=,Gender=>}Data), 0)<=10),
sum({1<Institution=,[Subject marker]=-{'Other'},[Standard Institution Code]={
'01 mining',
'02 agriculture',
'05 engineering',
'08 manufacturing',
'13 defence'},Gender=>}Data), / sum({1<Institution=, [Subject marker]=-{'Other'},[Standard Institution Code]=,Gender=>}Data), 0))
Now the question; looking at the above you can see that the code to select different [Standard Institution Code] is used twice, i.e. this bit
sum({1<Institution=,[Subject marker]=-{'Other'},[Standard Institution Code]={
'01 mining',
'02 agriculture',
'05 engineering',
'08 manufacturing',
'13 defence'},Gender=>}Data)
Not only is this used in this expression but it's also used in other places in the file.
Is there any way I can define this as some form of #define / saved expression (e.g. SavedExpression1) and then call it back up by name? I'm using the Personal edition of QlikView if it makes any differnece
I should say I've tried to save this expression as a variable but it evaluates the variable as a single value for the whole data set (probably on loading the data in the first place), rather than calculating the value on each row of a table
thanks
Use :
SET myVar = ... write your expression and when you use that variable write:
E.g.: $(=myVar)
Let me know
Use :
SET myVar = ... write your expression and when you use that variable write:
E.g.: $(=myVar)
Let me know
Alessandro
Thanks for the quick reply, where should I place the SET? in the main script or in the chart specific script?
EDIT - I placed the SET code in teh main script and it worked a treat, thanks!!!!!
Thanks
In the script ...