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: 
nudjaree1
Partner - Contributor III
Partner - Contributor III

Count Max(value) by each ID

Hi, 

I am trying to get Count for Max(Value) 

This is my dataset 

IDNoValue
1111
1230
1330
2140
2240
2310
3110
4110


 and I want the result be like this 

IDMax ValueCount Max Value
1302
2402
3101
4101

 

I try to use this count({<Value = {'$(=max(Value))'}>} No)

but I got 0 in the result 

IDMax ValueCount Max Value
1302
2400
3100
4100


Expression evaluated show only 30 for the Max (value) 

count({<Value = {'30'}>} No)

Is it possible to get the first row number of the Max(Value)?

Thank you in advance.

Labels (1)
1 Solution

Accepted Solutions
MayilVahanan

Hi @nudjaree1 

May be,try like below

Sum(Aggr(if(Value = Max(Total<ID>Value), 1, 0) , ID, No))

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

6 Replies
marcus_sommer

You may try: count({<Value = {"=Value=max(Value)"}>} No) 

whereby it's not a real set analysis anymore else it worked like an if-loop.

- Marcus

nudjaree1
Partner - Contributor III
Partner - Contributor III
Author

Hi Marcus, 

Thank you for the answer but  I got 8 for every ID

Max ValueMax Value
1308
2408
3108
4108

 

Regards 

Nudjaree

MayilVahanan

Hi @nudjaree1 

May be,try like below

Sum(Aggr(if(Value = Max(Total<ID>Value), 1, 0) , ID, No))

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
nudjaree1
Partner - Contributor III
Partner - Contributor III
Author

Thank you MayiVahanan.  It works 🙂 

 

nudjaree1
Partner - Contributor III
Partner - Contributor III
Author

Is it possible to get the first NO of Sum(Aggr(if(Value = Max(Total<ID>Value), 1, 0) , ID, No))

ID  MAx  Count No

1   30       3         2

2   40     3           1

3     10    1           1

4   10     1            1

CHRIS_Singa
Creator
Creator

Hey @nudjaree1 ,

Would you tell me how you have done to get the Max Value for each ID ?

Please,

Max value.PNG