Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Max function not working

Hello all,


I am working with two max functions that aren't working, for the purposes of this project I am using the max to filter duplicates since I only want the latest record. I have tried to manipulate the function a number of different ways and still no luck.

**The max function worked before I added the extra fields called [RC Version Date], [RC Project Name],[RC Project Number], however when a design change was brought forward I added the fields but the max functions seemed to have stopped working since my table came back with 1995 records instead of 1992, so there were 3 duplicates.


LoadJoin:

LOAD *

FROM [\\ke_root.qvd] (qvd);

Left Join

LOAD *

FROM [\\ke_task.qvd] (qvd);

Left Join (LoadJoin)

LOAD [KE Task ID],

  [RC Version Date],

  [RC Project Name],

  [RC Project Number],

  Max(Date([Last KE Task Work Info Date Q5])) as [Last KE Task Work Info Date Q5],

  Max(Date([Last KE Task Work Info Mod Date Q5])) as [Last KE Task Work Info Mod Date Q5]

FROM

[\\ke_task_work_info.qvd] (qvd)

Group By [KE Task ID], [RC Version Date], [RC Project Name], [RC Project Number];

Thanks,

Nick

5 Replies
MindaugasBacius
Not applicable

Re: Max function not working

Have you tried loading only the last part of your code?

LOAD [KE Task ID],

  [RC Version Date],

  [RC Project Name],

  [RC Project Number],

  Max(Date([Last KE Task Work Info Date Q5])) as [Last KE Task Work Info Date Q5],

  Max(Date([Last KE Task Work Info Mod Date Q5])) as [Last KE Task Work Info Mod Date Q5]

FROM

[\\ke_task_work_info.qvd] (qvd)

Group By [KE Task ID], [RC Version Date], [RC Project Name], [RC Project Number];

Not applicable

Re: Max function not working

Hello Mindauags,

Will not run without the remainder of code.

sunny_talwar
Not applicable

Re: Max function not working

Did you ever try to use the ApplyMap() method of doing this?

Not applicable

Re: Max function not working

I have, no success, sunny...

tom2qlik
Not applicable

Re: Max function not working

Try loading the "RC" fields separately to the max(Date) fields in different tables and then join the two tables together.  Something like:

RCLoad:

LOAD

  [KE Task ID],

  [RC Version Date],

  [RC Project Name],

  [RC Project Number]

FROM [\\ke_task_work_info.qvd] (qvd);

Inner Join (RCLOAD)

LOAD

  [KE Task ID],

  Max(Date([Last KE Task Work Info Date Q5])) as [Last KE Task Work Info Date Q5],

  Max(Date([Last KE Task Work Info Mod Date Q5])) as [Last KE Task Work Info Mod Date Q5]

FROM

[\\ke_task_work_info.qvd] (qvd);

Left Join (LoadJoin)

Load *

Resident RCLoad;