Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
csmqlik01
Contributor III
Contributor III

Showing the highest value

Hi,

I have follewing table ,  agecountdays is a calculated field based on batch and posting date with AGGR 

=[Posting date]- Aggr(nodistinct Min([Posting date]), Batch)

But now I want only the line with the highest days , and on C1 - End SoS & SiT , so can this within the above syntax 

Batch[Posting date]AgeCountDaysQuantity tonsKey Column-a
21848A13251/11/201700,620A1 - Start SoS & SiT
21848A132530/11/201729-0,620C1 - End SoS & SiT
21848A13251/12/2017300,620A1 - Start SoS & SiT
21848A132531/12/201760-0,620C1 - End SoS & SiT
21848A13251/01/2018610,620A1 - Start SoS & SiT
21848A132531/01/201891-0,620C1 - End SoS & SiT
21848A13251/02/2018920,620A1 - Start SoS & SiT
21848A132528/02/2018119-0,620C1 - End SoS & SiT

 

Regards,

1 Solution

Accepted Solutions
csmqlik01
Contributor III
Contributor III
Author

Hi,

Thanks for your effort and search 

But I created a second table where i used the AGGR function with distinct and then it shows only one line with the batch

Maybe this is the best, i have now a detail table and an overview table.

Best regards,

 

 

 

 

View solution in original post

5 Replies
vishsaggi
Champion III
Champion III

Not sure if this is good way of doing it but may be you can try like below:

LOAD *,
AutoNumber(PostingDt,Year(PostingDt)&Month(PostingDt)) AS SeqID;
LOAD Batch,
Date(Num(Floor(Date#("[Posting date]", 'DD/MM/YYYY'))),'DD/MM/YYYY') AS PostingDt,
AgeCountDays,
[Quantity tons],
[Key Column-a]
FROM
[https://community.qlik.com/t5/New-to-Qlik-Sense/Showing-the-highest-value/m-p/1552521#M128865]
(html, utf8, embedded labels, table is @1);

Then add straight table with Dimensions as
=IF(SeqID = 2,Batch) ---> For this calculated dimension check suppress when value is null.
PostingDate
Key Column-a

Expression as :
=Interval(PostingDt - Aggr(NODISTINCT Min(PostingDt), Batch), 'D')

Then you should see only Max Ages. Try and let me know if it works.
csmqlik01
Contributor III
Contributor III
Author

Thanks for the suggestion,

But I was more thinking of a solution in an expression, all the dimensions are loaded from a SQL server,  the example is just a small part  of the model. And the field AgeCountDays is an calculated field.

vishsaggi
Champion III
Champion III

The best way to handle this is through script i feel, it will be resource heavy to handle this in UI with calculated aggr dimensions or expressions. Have to try in UI how to handle this meanwhile if you think you can do a resident load or preceding load to your SQL script adding those date dimensions, it will perform well. Will keep you posted about UI solution once i work on it.
csmqlik01
Contributor III
Contributor III
Author

Hi,

Thanks for your effort and search 

But I created a second table where i used the AGGR function with distinct and then it shows only one line with the batch

Maybe this is the best, i have now a detail table and an overview table.

Best regards,

 

 

 

 

vishsaggi
Champion III
Champion III

Not sure i understood your table. If it suffice your requirement that is great. You can close the thread accordingly.