Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

Less/Greater than a variable in set analysis using

Hi All,

I have reviewed almost every thread on this but can't get it to work.

I want to be able to use less and greater than variables in set analysis. Please see below and let me know how I can fix the variable part.

sum({<field1={'1'},field2={>"$(vVariable2)"},[field3]={<"$(vVariable3)"}>}[field4])

Thanks!!

10 Replies
swuehl
Not applicable

Re: Less/Greater than a variable in set analysis using

Try like

sum({<field1={'1'},field2={">$(vVariable2)"},[field3]={"<$(vVariable3)"}>}[field4])

sunny_talwar
Not applicable

Re: Less/Greater than a variable in set analysis using

Try this:

Sum({<field1={'1'}, field2={">$(=vVariable2)"}, [field3] = {"<$(=vVariable3)"}>}[field4])

or

Sum({<field1={'1'}, field2={">$(=$(vVariable2))"}, [field3] = {"<$(=$(vVariable3))"}>}[field4])

Not applicable

Re: Less/Greater than a variable in set analysis using

Thanks! Can I also do a calculation inside that as well? Realized I need to add 1 to vVariable2, but dont want to introduce a new variable.

sum({<field1={'1'},field2={">$(vVariable2)+1"},[field3]={"<$(vVariable3)"}>}[field4])

Not applicable

Re: Less/Greater than a variable in set analysis using

Thanks! Can I also do a calculation inside that as well? Realized I need to add 1 to vVariable2, but dont want to introduce a new variable.

sum({<field1={'1'},field2={">$(vVariable2)+1"},[field3]={"<$(vVariable3)"}>}[field4])

Not applicable

Re: Less/Greater than a variable in set analysis using

or if I can have an if right after that does it for me, that should work too?

sunny_talwar
Not applicable

Re: Less/Greater than a variable in set analysis using

May be this:

Sum({<field1={'1'}, field2={">$(=$(vVariable2)+1)"}, [field3] = {"<$(=$(vVariable3))"}>}[field4])

or

Sum({<field1={'1'}, field2={">$(=vVariable2+1)"}, [field3] = {"<$(=vVariable3)"}>}[field4])

Not applicable

Re: Less/Greater than a variable in set analysis using

None seem to work, is there a way to have the variable greater/less than outside the {<>} and use an if statement for that?

swuehl
Not applicable

Re: Less/Greater than a variable in set analysis using

Sure, this should be possible.

How is your variable defined? Is it just a static number?

Maybe like Sunny suggested, or try also

sum({<field1={'1'},field2={">$(=vVariable2+1)"},[field3]={"<$(vVariable3)"}>}[field4])

Not applicable

Re: Less/Greater than a variable in set analysis using

didn't work...my variable is defined in the load script based on a field.

how can I have it as a combination of if and set analysis? wanna do the following:

sum({<field1={'1'}>} if (field2 > $(vVariable2+1),field3=$(vVariable3)), [field4])