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: 
sogloqlik
Creator III
Creator III

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
MVP
MVP

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;

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
sogloqlik
Creator III
Creator III
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 III
Creator III
Author

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

 

Thx.