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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
paulwalker
Creator III
Creator III

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 III
Creator III
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!