Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I wanted to know if its possible to pass in values from when calling your expression for set analysis. Example
vExpression =sum({< Color = {"$1"}>}ACTUAL)
vExpression("Blue")
What am i doing wrong here?
I dont have a variable $1 i was using that to hold the value of the first value passed when i called the vExpression variable. So if i just wanted to pass in a value into this expression how should it be.
vExpression =sum({< Color = {"$(1)"}>}ACTUAL)
Try it with:
vExpression:
sum({< Color = {$1}>}ACTUAL)
and then by calling them:
$(vExpression('Blue'))
- Marcus
Understood what you needed now.
The thing is, to replace the value, you'd have to expand the expression, like so
I defined a variable named Expression and value:
sum({< Color = {$1}>}ACTUAL)
Next, i've put an expression that gets the following:
$(Expression('a'))
That will expand expression with the parameter 'a', giving me:
You can from there create "dynamic" set analysis (with the same expression), with expressions like:
$(Expression("1"))
$(Expression("2"))
Thanks so much for getting back to me. Yes it works in Qlikview but iam not sure why iam having an issue doing this in QlikSense. I have used this in Qlikview alot but not sure why in Qlik Sense its giving me issues. exact same formula. Not sure if its anything to do with the way the variable is setup. All of them are setup as SET during load script.
That's weird, it works fine on Sense too:
Got it from this script:
Load
date#(Data,'DD/MM/YYYY') as Teste,
*;
load * inline
[
Data,Type,Value
01/01/2019,a,100
02/01/2019,b,200
03/01/2019,c,300
04/01/2019,d,400
05/01/2019,e,500
];
set Expression = sum({< Type = {$1}>}Value);
And put as expression the following: $(Expression('a'))
Maybe you're pointing to the wrong field on your expression?
Hi, What if I want to pass multiple values to color filed. Like I want data for Blue and Red. So I will say:
sum({<color={'red','blue'}>}Actual)
But if I want to pass it dynamically then what is the correct way. The above thread talks about single value to color field in set analysis
Within a variable-parameter are commas always treated as a parameter-delimiter without any possibility to mask them. If they are really needed you have 3 workarounds to handle such scenarios:
In your case the last would be the most simple one, for example:
vExpression:
sum({< Color = {$1}>}ACTUAL)
and then by calling them:
$(vExpression((blue|red)))