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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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!

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

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

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

Awesome