Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
kkkumar82
Specialist III
Specialist III

set analysis with search string including input variables

Hi folks

I have the following expression

='The sum of sales between 2006 and 2010 is '& sum({$<Year = {">= 2006 <= 2010"}>}Sales) which is working fine

                                    but

I have created two variables in the settings->variable overview with default values 2004 and 2010 vmin and vmin and wrote a expression in a text box as

='The sum of sales between 2006 and 2010 is '& sum({$<Year = {">= $(vmin) <= $(vmax)"}>}Sales)

   I am not getting the correct answer , the sum function is not considering 2006 and 2010 rather it is taking all the years

actually my need is

I want to have two input boxes which has to take min and max years from the users and I want to use those variables in a text box

as above. I took transact file sample of Qlikview for this.

can anybody suggest me a solution for this.

1 Solution

Accepted Solutions
Not applicable

Hi,

Your expression is correct, just check if variables are correct.I have used the same expression and it's working perfectly.

='Sales '&sum({$<Year={">=$(vMin)<=$(vMax)"} >}Sales)

Regards,

Navdeep

View solution in original post

4 Replies
Not applicable

Hi,

Your expression is correct, just check if variables are correct.I have used the same expression and it's working perfectly.

='Sales '&sum({$<Year={">=$(vMin)<=$(vMax)"} >}Sales)

Regards,

Navdeep

kkkumar82
Specialist III
Specialist III
Author

Yeah you are correct I missed v in vMax in original expression.

Thanks

kkkumar82
Specialist III
Specialist III
Author

Hi navdeep,

This time I took two variables vmin = min({1} Year) and vmax = max({1} Year)

and I used these two for input boxes , to my strange the input boxes are showing the same expressions after '=' but the not 2004(min) and 2010(max) and my expression sum({$<Year = {">= $(vmin) <= $(vmax)"}>}Sales) is showing 0.

any suggestions

I attached the qvw to my original post.

kkkumar82
Specialist III
Specialist III
Author

Hey got the solution finally , I have to use the expression as follows

='The sum of sales between '& $(vMin)&' and '&$(vMax)&' is '& sum({$<Year = {">=  $(=$(vMin))

     <=  $(=$(vMax))"}>}Sales)