Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Find the latest day a product was sold

Im trying to find the last day every product was sold in a sales file, please help me

EG I need to assign the latest invoiced date of each product

Regards

Jörgen

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Jörgen,
Something like this:


JOIN (Sales) LOAD
ProductId,
max(InvoiceDate) as LastInvoiceDate
RESIDENT Sales
GROUP BY ProductId


View solution in original post

7 Replies
Anonymous
Not applicable
Author

Jörgen,
Something like this:


JOIN (Sales) LOAD
ProductId,
max(InvoiceDate) as LastInvoiceDate
RESIDENT Sales
GROUP BY ProductId


Not applicable
Author

On the script

Data:
LOAD Product, Date

FROM yourfile;

LOAD
Id ,max(Date) as LastDate
RESIDENT Data
GROUP BY Id
;

Then use LastDate as a new field.

Jean-Jacques

Not applicable
Author

Hello plokijuh.

I wonder if you could post your application to be analysed.

I'd like to look your application to be more effective.

Thanks.

Huberto.

Not applicable
Author

Thanks it worked, but I got the answer in a numeric way like 39084 how do i make date out of this again?

Regards

Jörgen

Not applicable
Author

Open the property windows of your graphic,

go to NOMBRE ( maybe number in english, sorry a french version), and clik on date date & hour (if so).

Jean-Jacques

Not applicable
Author

Hi.

I think you could have the same information in a simple expression, but if create this field in your table during the load is better, I suggest you to use the function date with the format that you want.


JOIN (Sales)
LOAD
ProductId,
date(max(InvoiceDate), 'DD/MM/YYYY') as LastInvoiceDate
RESIDENT
Sales
GROUP BY ProductId;


Give a look at my suggestion and let me know if it helped you.

Huberto.

danielrozental
Master II
Master II

how about FirstSortedValue(InvoiceDt,-InvoiceDt), then you don't need to do anything at script level.