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

trying to use a group by in load editor max()

Hello I'm trying to return only the max values from the column MOD_DATE grouped by my key.  Here is my script but I am getting an invalid expression when I try to run. 

 

TEMP:
LOAD
ACTIVITY_DATE,
MUID as SCHED_MUID,
//AGENTDATA,
EXCEPTION,
MINUTES,
MINUTES/60 as Minutes1,
TVID,
num(MODIFY_DATE) as MOD_DATE,
num(TVID) & '|' & date(floor(ACTIVITY_DATE)) as KEY_IdDate
FROM [some.qvd]
(qvd)
where SCHED_DATE >= '2019-09-01'
;


TOTAL_VIEW_AGENT_SCHE_DTL:
Load
KEY_IdDate,
max(MOD_DATE) as Max_Mod,
Minutes1
Resident TEMP
Group BY KEY_IdDate;


DROP TABLE TEMP;

 

1 Solution

Accepted Solutions
Taoufiq_Zarra

Maye be :

TEMP:
LOAD
ACTIVITY_DATE,
MUID as SCHED_MUID,
//AGENTDATA,
EXCEPTION,
MINUTES,
MINUTES/60 as Minutes1,
TVID,
num(MODIFY_DATE) as MOD_DATE,
num(TVID) & '|' & date(floor(ACTIVITY_DATE)) as KEY_IdDate
FROM [some.qvd]
(qvd)
where SCHED_DATE >= '2019-09-01'
;


TOTAL_VIEW_AGENT_SCHE_DTL:
noconcatenate
Load
KEY_IdDate,
max(MOD_DATE) as Max_Mod
Resident TEMP
Group BY KEY_IdDate;
left join
load * resident TEMP;


DROP TABLE TEMP;
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

3 Replies
Taoufiq_Zarra

try to remove Minutes1 from the


TOTAL_VIEW_AGENT_SCHE_DTL:

script's

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
danaleota1
Creator
Creator
Author

The script runs when I remove Minutes1 however I still need this field.  It's actually the measure I need.  "max(MOD_DATE) as Max_Mod"  I know I used an aggregate function but this is actually a dimension where I only need returned is the record that has the highest value of the MOD_DATE.  

Taoufiq_Zarra

Maye be :

TEMP:
LOAD
ACTIVITY_DATE,
MUID as SCHED_MUID,
//AGENTDATA,
EXCEPTION,
MINUTES,
MINUTES/60 as Minutes1,
TVID,
num(MODIFY_DATE) as MOD_DATE,
num(TVID) & '|' & date(floor(ACTIVITY_DATE)) as KEY_IdDate
FROM [some.qvd]
(qvd)
where SCHED_DATE >= '2019-09-01'
;


TOTAL_VIEW_AGENT_SCHE_DTL:
noconcatenate
Load
KEY_IdDate,
max(MOD_DATE) as Max_Mod
Resident TEMP
Group BY KEY_IdDate;
left join
load * resident TEMP;


DROP TABLE TEMP;
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉