Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic min and max values for Slider Object

Hello,

I have a graph comparing 2 quarters, users can select any 2 quarters to compare and the graph updates accordingly. I am accepting 2 variables from users (each for one quarter) and using set expression for my X axis on the graph.


The expression looks like this -

=Sum({<YearQuarter= {'$(vYearQuarter1)'}>}MValue) - Sum({<Year = {'$(vYearQuarter2)'}>}MValue)


Now I want to obtain min and max values for the above set expression i.e. the min and max values from my X axis and use that as an input to the slider such that users will have ability to filter the values on X axis (e.g. to weed out the outliers). I will use a variable to capture the threshold set by slider and will show only values greater than the slider threshold. So my above graph expression will be


=IF(Sum({<YearQuarter= {'$(vYearQuarter1)'}>}MValue) - Sum({<Year = {'$(vYearQuarter2)'}>}MValue) > vthreshold, =Sum({<YearQuarter= {'$(vYearQuarter1)'}>}MValue) - Sum({<Year = {'$(vYearQuarter2)'}>}MValue))


But when I try to use Min and Max on the above set expression, I get garbage value error


=Min(Sum({<YearQuarter= {'$(vYearQuarter1)'}>}MValue) - Sum({<Year = {'$(vYearQuarter2)'}>}MValue))


How do I get the min and max values from the above expression i.e. min and max values for my X axis.


Thanks!

1 Solution

Accepted Solutions
sunny_talwar

Try this:

For Min:

=Min(Aggr(Sum({<YearQuarter= {'$(vYearQuarter1)'}>}MValue) - Sum({<Year = {'$(vYearQuarter2)'}>}MValue), YourChartDimensions)


For Max:

=Max(Aggr(Sum({<YearQuarter= {'$(vYearQuarter1)'}>}MValue) - Sum({<Year = {'$(vYearQuarter2)'}>}MValue), YourChartDimensions)


HTH


Best,

Sunny

View solution in original post

3 Replies
sunny_talwar

Try this:

For Min:

=Min(Aggr(Sum({<YearQuarter= {'$(vYearQuarter1)'}>}MValue) - Sum({<Year = {'$(vYearQuarter2)'}>}MValue), YourChartDimensions)


For Max:

=Max(Aggr(Sum({<YearQuarter= {'$(vYearQuarter1)'}>}MValue) - Sum({<Year = {'$(vYearQuarter2)'}>}MValue), YourChartDimensions)


HTH


Best,

Sunny

Not applicable
Author

worked perfectly! thanks!

sunny_talwar

Awesome