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: 
Not applicable

Get max and min monthwise

Please help me find the max and min value of each month in a straight table.

aggr(max(price),month) gives the max value correctly. But the corresponding item appears incorrectly. Even tried using firstsortedvalue.

Sales:

Load * Inline

[item, month, price

Carrot, Jan, 150

Beans, Jan, 90

Onion, Jan, 40

Brinjal, Feb, 60

Carrot, Feb, 130

Onion, Feb, 50

Beans, Mar, 100];

I wud like to see the results as follows in a straight table or 2 diff tables (one for max and one for min)

Month Maxprice Item    Minprice Item

Jan      150       carrot   40         Onion

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Used firstsortedvalue(), please find attached.

Hope this helps!

View solution in original post

1 Reply
jerem1234
Specialist II
Specialist II

Used firstsortedvalue(), please find attached.

Hope this helps!