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: 
raghavsurya
Partner - Specialist
Partner - Specialist

Using Min and Max functions

Hi All,

I have 3 diferrent expressions given below. I have a requirement where in one of fields in the table should show the Minimum of the values derived from below expressions if the user clicks "Min" in the list box.

(Sum({<Year={$(=Max(Year))}>} PAmount ))

(Sum({<Year={$(=Max(Year))}>} AAmount ))

(Sum({<Year={$(=Max(Year))}>} BAmount ))

Similarly if the user clicks "Max" in the list box, the max value among the above expressions should be picked up.

Can anybody help me in putting the expression for Min and Max values.

Regards,

Raghav

4 Replies
Not applicable

Hi Raghav,

Create an inline table with values 'Min' and 'Max'.

Assign the value of this field to a variable and use it in the set analysis.

Whenever the user selects the 'Min' or 'Max' it will be assigned to the variable and it will be in turn used by the set analysis

<code>

variable definition:

sortval=GetFieldSelections(sort)&'(Year)'

expression definition:

(Sum({<Year={$(=$(sortval))}>} PAmount ))

(Sum({<Year={$(=$(sortval))}>} AAmount ))

(Sum({<Year={$(=$(sortval))}>} BAmount ))

</code>

Cheers,

Haneesh

raghavsurya
Partner - Specialist
Partner - Specialist
Author

Hi Haneesh,

Thanks for your reply. I will try to elaborate my question. I have a list box with the following values

Min , Max and Avg

For Share valuation I need to pick Min or Max or Avg values coming out of below mentioned expressions.

(Sum({<Year={$(=Max(Year))}>} PAmount )))) assume the outcome of this expression is $2000

(Sum({<Year={$(=Max(Year))}>} BAmount )))) assume the outcome of this expression is $3000

(Sum({<Year={$(=Max(Year))}>} AAmount )))) assume the outcome of this expression is $4000

now if I click Min $ 2000 should be picked up for share valuation, similarly if Max is clicked $4000 should be picked up.

Can you please help me how to do it.

Regards,

Raghav

johnw
Champion III
Champion III

Perhaps this?

if(MyField='Min',rangemin(sum(...PAmount),sum(...BAmount),sum(...AAmount))
if(MyField='Max',rangemax(...)
,rangeavg(...)))

raghavsurya
Partner - Specialist
Partner - Specialist
Author

Thanks John.... It works. Perhaps I used "NumMin", NumMax and Num Avg functions.

Regards,

Raghav