Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I have a series of measure that all have almost the same expression. For maintenance purpose I would like to use something like local variable in the expression so that the measure formula is the same (but this variable)
My expression would be:
// My local variable
var = 2
// The calculus
2* var
Does something like that exist in QLikSense ?
ahh, that's possible as well by using parameters. You can define those as $1, $2 etc:
Set MUL=’$1*$2’;
Let X=$(MUL(3,7)); // returns 21 in X
Sure does!
in the script you could define a variable with:
SET vVar = 2;
And then use it in a calculation as:
2*$(vVar)
In the worksheet this would work much the same. You can use a variable defined in the script, or define one from the worksheet (button in the bottom-left corner) and even use a variable input to let users change the value. Then use it in a calculation in the same way as above.
Thank you, but that's not exactly what I wanted ...
I want to be able to define this variable Inside the measure expression, not inside the script
ahh, that's possible as well by using parameters. You can define those as $1, $2 etc:
Set MUL=’$1*$2’;
Let X=$(MUL(3,7)); // returns 21 in X