Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
DGE_TAS
Contributor II
Contributor II

Invalid expression

Hello, 

One of the developer working on my Qlik Sense site gets the error "Invalid expression" with this following query: 

Load ID_DOC, if (num(STARTDATE) =Max (STARTDATE), 'LastWKF', 'OldWKF') as WKFREV

Do you have any lead? 

Regards

Labels (1)
4 Replies
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

It's a script expression. You are using a Max() function, you need a group by:

 

Load

 ID_DOC,

  if (num(STARTDATE) =Max (STARTDATE), 'LastWKF', 'OldWKF') as WKFREV

Resident MyTable

Group By

  ID_DOC

;

Help users find answers! Don't forget to mark a solution that worked for you!
DGE_TAS
Contributor II
Contributor II
Author

Hello Thanks for your answer. 

Sorry I forgoit to give the entire express on my previous post. 

If fact, the developper is well using a group by and got the error: 

Here teh full expression: 

Join (WKF)

Load ID_DOC

              ,if(num(STARTDATE) =Max(STARTDATE),'LastWKF', 'OldWKF') as WKFREV

resident DOC

Group by ID_DOC

;

Any clue on where the error may be from? 

Thanks in advance. 

DGE

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

 

I think you can't use this expression in your case: num(STARTDATE)=Max(STARTDATE)

 

For num(STARTDATE) you need to add STARTDATE in your group by, but if you do that Max(STARTDATE) return STARTDATE.

 

You can do in two step.

 

left join(DOC)

Load

  ID_DOC,

  Max(STARTDATE) as STARTDATE,

  Max(STARTDATE) as MAXDATE

resident DOC

Group by ID_DOC

;

 

Join (WKF)

Load

  ID_DOC,

  if(not isNull(MAXDATE),'LastWKF', 'OldWKF') as WKFREV

resident DOC

;

 

drop field MAXDATE;

 

Help users find answers! Don't forget to mark a solution that worked for you!
DGE_TAS
Contributor II
Contributor II
Author

Hi Aurélien, 

Thanks for your answer which has been submitted to the developer.  

I will let you know as soon as i get his answer. 

Best regard. 

DG