Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Deduplicate and highest value in chart

Hi,

I have the following problem:

I have a table with "Poliy_nr", "Loss_nr" and "Amount":

The table is as following:

Policy_nr         Loss_nr          Amount

50899              1                        1.000           

50899              2                        1.000 

50899              3                        1.000 

12987              1                        2.000

12987              2                        2.000

81790              1                        3.000

81790              2                        3.000

81790              3                        3.000

81790              4                        3.000

81790              5                        3.000

13343              1                        4.000

13343              2                        4.000

I just want the highest "Loss_nr" in eacht "Policy_nr".

The result must show the following:

Policy_nr         Loss_nr          Amount

50899              3                        1.000 

12987              2                        2.000

81790              5                        3.000

13343              2                        4.000

Hopefully somebody can help me how I can achieve this.

I am struggling this problem for days without any success.

1 Solution

Accepted Solutions
Digvijay_Singh

Gud, If you feel so please mark maxgro‌ 'response' as right answer to close the thread.

View solution in original post

9 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

for loss_nr you can use a simple max

for the amount you can use firstsortedvalue(Amount,-Loss_nr)

maxgro
MVP
MVP

firstsortedvalue(Loss_nr,-Loss_nr)

firstsortedvalue(Amount,-Loss_nr)

1.png

Anonymous
Not applicable
Author

It might be a stupid question, but I am new to Qlikview. Could you please explain how I can use the "max" en if I have to do that in the script of priorities of the chart and on which tab.

Anonymous
Not applicable
Author

I tried but without any success. Is it possible to send me an example in a qvw?

Digvijay_Singh

Like this!

maxgro
MVP
MVP

It's a straight table chart with 1 dimension and the 2 expressions I posted,

you can find the chart in Digvijay Singh attachment (175884.qvw)

Anonymous
Not applicable
Author

Thanks a lot! It works.

Anonymous
Not applicable
Author

Thanks Massimo Grossi and Digvijay Singh, you both really helped me.

I am very happy to have the solution finely!

Digvijay_Singh

Gud, If you feel so please mark maxgro‌ 'response' as right answer to close the thread.