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

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

how to find the minimum value in a row and its corresponding header

hello everyone!

Can someone help on a script that can find the minimum value of a row and also return its corresponding header? See the below example.

Thanks in advance.

input:

     

ABCD
John3448
Lisa2187
Alex7511

output:

   

JohnA3
LisaB1
AlexC&D1
1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Data:

CrossTable(Alpha,Value)

Load * Inline

[

  Name A B C D

  John 3 4 4 8

  Lisa 2 1 8 7

  Alex 7 5 1 1

] (delimiter is \t);

Left Join (Data)

Load Name, Min(Value) as MinValue Resident Data Group By Name;

NoConcatenate

Final:

Load Name, Concat(Alpha,',') as Alpha, Value Group By Name, Value;

Load Name, Alpha, Value Resident Data Where Value = MinValue;

Drop Table Data;

View solution in original post

4 Replies
MK_QSL
MVP
MVP

What is the logic here?

1) Why John and A is 3 ?

MK_QSL
MVP
MVP

Data:

CrossTable(Alpha,Value)

Load * Inline

[

  Name A B C D

  John 3 4 4 8

  Lisa 2 1 8 7

  Alex 7 5 1 1

] (delimiter is \t);

Left Join (Data)

Load Name, Min(Value) as MinValue Resident Data Group By Name;

NoConcatenate

Final:

Load Name, Concat(Alpha,',') as Alpha, Value Group By Name, Value;

Load Name, Alpha, Value Resident Data Where Value = MinValue;

Drop Table Data;

Anonymous
Not applicable
Author

sorry about the confusion. The logic here is that A, B, C and  D are the item names and numbers are the quantity each person bought the items. And I would like to know which item each person bought the least.

in row 3, Alex bought C&D the least, which is only once.

Anonymous
Not applicable
Author

Perfect! Thank you so much!