Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get Data with Max Value for each ID

Hi,

I need a solution for my problem.

I have raw data like this:

IDNameTotal_TRX
1A10
1B20
2C20
3D50
3E1

The result i expect is:

IDNameTotal_TRX
1B20
2C20
3D50

So, i want to get the record that has max Total_TRX value for each ID

Is it possible to make it with QlikView load script ?

Really appreciate your help.

Thanks in advance.

1 Solution

Accepted Solutions
Anil_Babu_Samineni

I really don't why do you need this? Sometime, They want whole data then what you do. Anyway, for your question answer should this

Welcome:

LOAD * Inline [

ID, Name, Total_TRX

1, A, 10

1, B, 20

2, C, 20

3, D, 50

3, E, 1

];

NoConcatenate

MainTable:

LOAD

          ID,

          MAX(Total_TRX) as Total_TRX

Resident Welcome Group By ID Order By ID;

Left Join

LOAD

     ID,

     Total_TRX,

     Name

Resident Welcome;

Drop Table Welcome;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

3 Replies
Anil_Babu_Samineni

I really don't why do you need this? Sometime, They want whole data then what you do. Anyway, for your question answer should this

Welcome:

LOAD * Inline [

ID, Name, Total_TRX

1, A, 10

1, B, 20

2, C, 20

3, D, 50

3, E, 1

];

NoConcatenate

MainTable:

LOAD

          ID,

          MAX(Total_TRX) as Total_TRX

Resident Welcome Group By ID Order By ID;

Left Join

LOAD

     ID,

     Total_TRX,

     Name

Resident Welcome;

Drop Table Welcome;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
aapurva09
Creator
Creator

Hi,

Using 'Group by ID' in the script will give you the expected results.

Anonymous
Not applicable
Author

Hi Anil,

Thanks for the solution, it solved my problem perfectly