10 Replies Latest reply: Jun 2, 2016 5:07 AM by Stefan Wühl

# 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!!

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

Try like

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

• ###### 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])

• ###### 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?

• ###### 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])

• ###### 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])

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

You can try to do something like

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

But I guess the other way should work as well.

It's probably just a matter of how your variables are defined and how the value is formatted.

So it would actually be helpful if you could show exactely how you have defined the variable and how the results look like.

Best by posting a small sample QVW.

• ###### 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])

• ###### 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])

• ###### 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])

• ###### 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?