Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Create expression to return the largest number

Good morning/evening.  I am trying to determine from the attached file where ECM has multiple Material and those respective material have different lead times.  I would like to develop script for an expression to determine based on lead time for that ECM what is the highest lead time.  Since there are duplicates of the highest number for now it doesn't matter.

13 Replies
Anonymous
Not applicable
Author

This will work:

Table:
LOAD
Left(ECM,6) as [AE PMR ECM LCL],
ECM as [AE PMR ECM],
MATERIAL,
[PROD PROC LT] as [AE PMR PROD PROC LT]
RESIDENT (or FROM) <your data source>;

LEFT JOIN (Table) LOAD
[AE PMR ECM],
Max([AE PMR PROD PROC LT]) as Maxprodlt
RESIDENT Table
GROUP BY [AE PMR ECM];

Basically it is the same as Ajay Prabhakaran suggests, just in a little different form.

Anonymous
Not applicable
Author

I pasted the script as follows...now it tells me the table doesn't exist



[\\frxfileserv1\ftpdown\WW_PUBLIC\Download Folder\New Product Programs-PMR 2.0\Local\RX01\AERO_PMR.XLS]

(
txt, codepage is 1252, embedded labels, delimiter is '\t', msq);



LEFT JOIN (Table) LOAD

[AE PMR ECM],

Max([AE PMR PROD PROC LT]) as Maxprodlt

RESIDENT Table

GROUP BY [AE PMR ECM];

Anonymous
Not applicable
Author

Sure, I don't know what is the correct name of your table

In my example it is Table.  In your case - whatever you named it.

Anonymous
Not applicable
Author

In my haste I deleted the script for the naming of the variable, but once I added that back in it works exactly as I was hoping it would.  Thank you for the help.  Obviously previous to this script it was a manual process to find the largest one.  Now its one click!