Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to create a condition using a variable?

Hi,
I have a field named week with 104 weeks.
I want to filter a sum for the weeks going between a variable named "vPeriod" and week 52. I have been trying things like the following unsuccessfully.
Sum ( { <Week = {"<=52"}, Week={">$(vPeriod)"}>}  Sales)
Any help?Thanks
2 Replies
johanlindell
Partner - Creator II
Partner - Creator II

Hi!

You were close. Did a formula similar to this a week ago. It should be:

Sum({ <Week = {'<=52>$(vPeriod)'}>}  Sales)

Best Regars

Johan Lindell

Not applicable
Author

Hi,

Put the value 52 in variable ,let the name of variable be "vVal"

thn try the below expression

=sum({<Week ={">$(vPeriod) <=$(vVal)"}>} Sales)

hope this will work.