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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Sagar082
Creator
Creator

How to used variable in set statement

Hi folks,

Greeting for the day. I am using below set expression, but not getting out.

Count({$<in_start = {vtime_n}>} flp_id)

But if I replace above statement with below,

Count({$<in_start = {15}>} flp_id)

It is working.

Where, in_start is an integer.

1 Solution

Accepted Solutions
EliGohar
Partner - Specialist
Partner - Specialist

@Sagar082 vtime_n is a variable that you want to use in your set analysis? If that's the case, please try this:

Count({$<in_start = {$(vtime_n)}>} flp_id)

 

Eli.

View solution in original post

6 Replies
EliGohar
Partner - Specialist
Partner - Specialist

@Sagar082 vtime_n is a variable that you want to use in your set analysis? If that's the case, please try this:

Count({$<in_start = {$(vtime_n)}>} flp_id)

 

Eli.

Sagar082
Creator
Creator
Author

Hi Eli,

Greeting for the day. Yes, your solution indeed worked.

I need more assistance, I hope you don't mind.

In the above set statement should be little modify to consider another variable to,

Count({$<in_start = {$(vtime_n)}>+<{$<in_start = {$(vtime_n_1)}>flp_id)

Where, vtime_n_1 is another variable which store value, (vtime_n)-1

I would like to know,

1. How to store the value of vtime_n-1 in variable? Am I using correct definition?

2. How I can incorporate in the set statement either as variable or directly like, $(vtime_n)-1, but it is not working.

EliGohar
Partner - Specialist
Partner - Specialist

@Sagar082 Please explain - It means you want to check that:

in_start field is equal to vtime_n (variable) OR vtime_n_1 (variable)?

 

Regarding your question about how to store the value in vtime_n_1 var, Try this:

$(vtime_n)-1

 

Eli.

Sagar082
Creator
Creator
Author

Hi Eli,

Greeting for the day. The in_start filed should have value between vtime_n and vtime_n_1, both inclusive.

For e.g. if user select hour 15, then the incidence occurring during 14-15 hrs. Should reflect.

EliGohar
Partner - Specialist
Partner - Specialist

Please try this:

Count({$<[in_start] = {">=$(vtime_n_1)<=$(vtime_n)"}>} flp_id)

 

Sagar082
Creator
Creator
Author

Hi, it is not working. I believe it is creating string whereas in_start is integer.