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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis - Find Max value and other fields

Hello,

I would appreciate any help wrt the following problem. I have a table as follows:

ColumnAColumnB
422
456
318
429
422

I am trying to do the following:

1. Select the MAX of ColumnA wher ColumnB value is the lowest (i.e. 22)

2. Only return a Single record and not both records where ColumnA is 4 and ColumnB is 22

Thanks in advance.

Regards,

Craig

1 Solution

Accepted Solutions
Not applicable
Author


Hi Craig, here's what I tried .....

View solution in original post

7 Replies
Not applicable
Author

Suggest you take a look at this thread for some pointers ....

http://community.qlik.com/message/120986#120986

Not applicable
Author

Hi Jasleen,

Thanks very much for referring me to the link but I am struggling to translate that example into code using the Min and Max functions to solve my problem. I would appreciate it if you could provide me with a sample set analysis statement.

Regards,

Craig

Not applicable
Author


Hi Craig, here's what I tried .....

Not applicable
Author

Thank you very much for your solution and that worked. It did make me wonder though as to how you could solve an extension of the problem as follows:

Col A          Col B          Col C

March          4               22

March          4               31

March          4               22

March          3               38

April            4               31

April            4               31

April            3               31

April            4               40

The objective would be to show for each unique value of Column A:

1. Max of Column B

and 2. Min of Column C

(and only a single unique combination per my original post)

The results would be:

Col A          Col B          Col C

March          4               22

April             4               31

I can post this as a new discussion if needed.

Thanks again and regards,

Craig

Not applicable
Author

Hi,

You can use the Min and Max at the load script. Attached the sample QVW  . Hope this rsolves your issue.

Not applicable
Author

Craig, check this one out...I withdrew a previous one I attached as I noticed it wasn't giving unique rows by Month. Hope this one works for you...

Sokkorn
Master
Master

Hi cschultz,

Try this

LOAD * INLINE [

ColA,          ColB,          ColC

March,        4,               22

March,        4,               31

March,        4,               22

March,        3,               38

April,          4,               31

April,          4,               31

April,          3,               31

April,          4,               40];

Create Straight Table with ColA as Dimension and two Expression MAX(ColB) and MIN(ColC)

Regards,

Sokkorn