Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sogloqlik
Creator II
Creator II

Show Latest update date only

Hi.

I Have  a straight table with 4 columns: Customer. Product, Update date and inventory (Quantity).

Not all the customers are updated daily and not all the products for a customer are updated in each update.

For each combination of customer & product, I need to show the latest update only.

How can this be achieved? 

Regards,

Motty

 

1 Solution

Accepted Solutions
MayilVahanan

Hi @sogloqlik 

Try like below

Aggr(max([Update date], customer , product)

or

Max(Aggr(max([Update date], customer , product))

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

5 Replies
QFabian
Specialist III
Specialist III

Hi @sogloqlik , here a sample of scripting for doing what you ask.

tell me if it works.

 

Data:

Load

Customer & ' | ' & Product   as %_Key,

Customer.

Product,

[Update date],

inventory

From yoursource;

 

Data2:

Load

%_Key,

max([Update date])   as [Max Update date]

Resident Data

group By %_Key;

QFabian
sogloqlik
Creator II
Creator II
Author

Hi.

 

Thx for your answer

Cant do it in the script. must be in the chart itself.

MayilVahanan

Hi @sogloqlik 

Try like below

Aggr(max([Update date], customer , product)

or

Max(Aggr(max([Update date], customer , product))

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

@sogloqlik  try mayils suggestion.

i would actually suggest a variation of @QFabian  s suggestion. in the script using max create  a flag which indicates the latest records for your combination.

then use that flag in set analysis. this would be most efficient and flexible way. aggr will work but can be a little heavy on processing.

Data:

Load
   Customer & ' | ' & Product   as %_Key,
   Customer,
   Product,
   [Update date],
   inventory
From yoursource;

left join (Data)
Load
   %_Key,
   max([Update date])   as [Max Update date]
   'Y' as LatestFlag
Resident Data
group By %_Key;
sogloqlik
Creator II
Creator II
Author

Combination of that on the Date and first sorted value on the Qty Solved the problem.

 

Thx.