Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
bartwelvaarts
Contributor III
Contributor III

get value by max date in weeks

hello friends of the qlik community,

I want to get the value of a particular order based on the max date, per week.

Now i only get the value of the max date, but i want this per week. This is how i do it now:

table1:
load
order,
amount,
datetime

from source

left join table1:
temo:
LOAD DISTINCT
Order
MAX(Datetime) AS MAX_MODIFIED
RESIDENT table1
GROUP BY order;


left JOIN(table1)
TEMP2:
LOAD DISTINCT
Order
amount
RESIDENT table1
WHERE Datetime=MAX_MODIFIED;

I added an example in excel with the desired output.

Hopefully someone can help me!

Labels (4)
1 Reply
justISO
Specialist
Specialist

Hi, you can try something like this:

table1:
load
order,
amount,
datetime
from source;

JOIN (table1)
LOAD DISTINCT
order,
week(datetime) as week,
Timestamp(MAX(datetime)) AS datetime
RESIDENT table1
GROUP BY order, week(datetime);

table:
LOAD
project, order, amount, week
RESIDENT table1
WHERE not isnull(week);

drop table table1;