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: 
thanhphongle
Creator II
Creator II

give out max/min from a column

hello community,

i need to know how i can give out the max/min from a column.

example

ProductCost
A100
B200
C300
D400
E500

If i choose product D it should compare the Cost of product D (400) with the other product's cost and finaly give out the minimum cost which is 100. something like this:

if Product D = 400 -> compare cost with other products -> give out min cost

could anyone please help me out here?

i know that there s an expression for max/min like max(Cost), but it does not make the comparison which i want to see.

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Min({<Product = >} TOTAL Cost)

View solution in original post

11 Replies
maxgro
MVP
MVP

try using total 

min(total Cost)

thanhphongle
Creator II
Creator II
Author

it does not work. it still gives me out D 400 if i select product d.

in fact it should work like this

i select from the product list - Product D

in the first chart it should give me out - Cost=400

in the second chart it should compare the cost of product D with the other costs and give me out the lowest cost - min cost=100

thanhphongle
Creator II
Creator II
Author

it gives me out product D's cost = 400 and min(cost)=400 if i select product D in my list

sunny_talwar

May be this:

Min({<Product = >} TOTAL Cost)

maxgro
MVP
MVP

1.png

thanhphongle
Creator II
Creator II
Author

it works! thank you very much!!

Anonymous
Not applicable

If it's correct, close the post and assing the correct answer to the user who help you

thanhphongle
Creator II
Creator II
Author

I still have another question.

now it gives me out correctly the min(Cost)=100. but can i combine it with another expression which gives me the product name of min(cost)=100

sth like this:

i select product d, Cost product D=400 , give me out min cost with the expression Min({<Product = >} TOTAL Cost) , and now give me out the referring product to the min(cost) which is product A in this excample.

sunny_talwar

Try this:

=Only({<Product = >} If(Cost = Min({<Product = >} TOTAL Cost), Product)

=Only(TOTAL{<Product = >} If(Cost = Min({<Product = >} TOTAL Cost), Product)) (Correct expression)

PFA the application also

Best,

Sunny