Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
paulwalker
Creator II
Creator II

Get Max Value

Hi Community,

Please take a look below script, It's working fine for Max Value..

A:
LOAD * INLINE [
ID, Value, Cat
1, 32, A
1, 89, B
1, 45,C
2, 31,A1
2, 32,A2
3, 59,B1
4, 30,C1
4, -39,C2
5, 21,D1
5, 34,D2
5, 46,D3
6, -,D4
];

LOAD ID, Max(Values) as MaxValue Resident A
Group By ID;

OutPut showing below like, It's repeating the value - my scenario It should not be repeat the value !

Thanks In Advance!

Labels (1)
1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

A:
LOAD * INLINE [
ID, Value, Cat
1, 32, A
1, 89, B
1, 45,C
2, 31,A1
2, 32,A2
3, 59,B1
4, 30,C1
4, -39,C2
5, 21,D1
5, 34,D2
5, 46,D3
6, -,D4
];

Temp:
LOAD ID&Max(Value) as Key Resident A
Group By ID;

B:
Load *,If(Exists(Key,ID&Value),1,0) as MaxFlag Resident A;

Drop table A,Temp;

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

A:
LOAD * INLINE [
ID, Value, Cat
1, 32, A
1, 89, B
1, 45,C
2, 31,A1
2, 32,A2
3, 59,B1
4, 30,C1
4, -39,C2
5, 21,D1
5, 34,D2
5, 46,D3
6, -,D4
];

Temp:
LOAD ID&Max(Value) as Key Resident A
Group By ID;

B:
Load *,If(Exists(Key,ID&Value),1,0) as MaxFlag Resident A;

Drop table A,Temp;

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
paulwalker
Creator II
Creator II
Author

Awesome Kaushik 🙂

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

That's great. 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!