Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
MVP
MVP

Try like

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

sunny_talwar

Try this:

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

or

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

Not applicable
Author

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
Author

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
Author

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

sunny_talwar

May be this:

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

or

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

Not applicable
Author

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
MVP
MVP

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
Author

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