Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good Morning!
I have a bunch of variables that I have moved from the variable overview screen (where I initially created them) to the Script. I was thinking this would allow for easier maintenance.
The variables however so not work once in the script.
The variable in the Variable overview screen is: sum({<Year = {$(=Only(Year)-1)}>}LineSalesAmount)
In the script it's: set vTemp = sum({<Year = {$(=Only(Year))}>}LineSalesAmount);
The result when in variable overview is correct, gives you last year's sum.
The result when in the script is wrong! for some reason it puts in a blank (like it never saw the $ expansion) in the year dimension (I found this by looking at the variable overview screen).
So when placed in the script QV thinks the variable is: sum({<Year = {}>}LineSalesAmount)
so apparently it's ignoring the $ expansion
Mystery? am I doing something wrong?
nope, didn't work
I think i'll just out the variables back into the variable overview screen and call it a day
In script, you can't use Set Analysis...
This is not allowed...
{<Year = {$(=Only(Year))}>}
Hi,
Try that, it will make the function to be calculated in each selection (you dont need to use the expansion $ symbol):
set vTemp = = sum({<Year = {$(=Only(Year))}>}LineSalesAmount);
This seemed to work, but I can't tell why the numbers aren't adding up. The formula says it's previous year, but the actual value is this year (or ignoring the set analysis).
Check attached sample
hi,
use
let vTemp = '=sum({<Year = {"' & chr(36) & '(=Only(Year)-1)"}>}Sales)';
in script. Problem here is that qlikview tries to evaluate the code after the $. Therefore replace it with it's ascii code.
Best
Stefan
nope, didn't work
I think i'll just out the variables back into the variable overview screen and call it a day
But if you do that, QlikView wins, and we can't allow that Try this:
LET vTemp = 'sum({<Year={$';
LET vTemp = vTemp & '(=Only(Year))}>}LineSalesAmount)';
Vlad
it does?!
what about?
let vTemp2 = replace ('sum({<Year = {@(=Only(Year))}>} Sales)', '@', '$');
I must've had a typo. Looks like it works!