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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with aggr max in straight table

Hello dear community,

I'm stuck on a silly problem.

I have the following table:

Capture.PNG

In a straight table I wish to display only the lines which confirm to the following rule:

Max of sequence for a given key.

I tried aggr(max(Sequence),Key), but it is for some weird reason picking out line 1 and 5.

Attached a sample app.

Thank you in advance for getting me unstuck!

Cheers

26 Replies
simenkg
Specialist
Specialist

Test1:

LOAD Sequence,

     Status,

     Key,

     product

FROM

D:\Users\hz9ybh\Desktop\test.xls

(biff, embedded labels, table is Sheet1$);

left join(Test1)

load Key, Max(Sequence) as maxSequence resident Test1 group by Key;

Test:

load *, if(Sequence = maxSequence,1,0) as isMaxSequence resident Test1;

Drop table Test1;


Then use isMaxSequence in your set analysis. So if you want the Sum of Value for these lines you write :

Sum({<isMaxSequence ={1}>} Value)

If you dont need the other sequences in your data model at all then you can add a Where clause to the last load:

Test:

load * resident Test1 where Sequence = maxSequence

;

Not applicable
Author

It works, but i'm still looking for a way to do it only with expressions in the chart.

hmmm .. thank you!

sasiparupudi1
Master III
Master III

Try

the attached file and see if it helps

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

Suggestion provided by Simen Kind Gulbrandsen. THe solution pushes most of calculation to script and a lighter UI and it's dynamic.

Not applicable
Author

Status is still wrong

Not applicable
Author

Using dynamic update in app, so not possible to reload app...

PrashantSangle

Hi,

I dont think so.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂