Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Dwyane
Contributor II
Contributor II

Max value

Hello

I have a table that looks like this

Col1Col2Col3Col4Col5Col6Col7
AAA110001/01/2020Context AContext FGFBContext GFC
AAA230001/01/2020Context AContext GFGBContext DDC
AAA3001/01/2020Context AContext GFGBContext ADC
AAA430001/01/2020Context AContext ZContext AC

 

The output i am looking for the the last record so max col2 but only grouped by col1 and col4 with the additional columns so my output would be this

Col1Col2Col3Col4Col5Col6Col7
AAA430001/01/2020Context AContext ZContext AC

 

I think i know how to do it in sql with a subquery but not sure how to so in Qlik script. Any help would be appreciated 

1 Solution

Accepted Solutions
Kushal_Chawda

@Dwyane  try below

Data:
LOAD Col1,
            Col2,
            Col3,
            Col4,
            Col5,
            Col6,
            Col7
FROM Table;

Left Join(Data)
LOAD Col1,
            Col4,
            max(Col2) as Col2,
1 as Flag
Resident Data
Group by Col1,
Col4;

Final:
NoConcatenate
LOAD *
Resident Data
where Flag=1;

DROP Table Data;

View solution in original post

4 Replies
Kushal_Chawda

@Dwyane  try below

Data:
LOAD Col1,
            Col2,
            Col3,
            Col4,
            Col5,
            Col6,
            Col7
FROM Table;

Left Join(Data)
LOAD Col1,
            Col4,
            max(Col2) as Col2,
1 as Flag
Resident Data
Group by Col1,
Col4;

Final:
NoConcatenate
LOAD *
Resident Data
where Flag=1;

DROP Table Data;

Dwyane
Contributor II
Contributor II
Author

Thanks for now i would just like to build a table via script nothing on the front-end just yet

Kushal_Chawda

@Dwyane  what we have provided is the script solution only

Dwyane
Contributor II
Contributor II
Author

Yes sorry i was responding to the other script that was posted which has been deleted