Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
pallesen
New Contributor II

Add max date field

Hi all,

I am trying to create an additional field (through my load script) called "Latest Date", which gives me the max LoginDate for each ID. So if max LoginDate for ID 2168 is 14-02-2017, then this date should appear in every row where ID = 2168.

How can I achieve this?

Thanks in advance!

1 Solution

Accepted Solutions

Re: Add max date field

Here i need to ask if you have LoginDate in your table it self then try with


MainTable:

Load

ID,

LoginDate,

...

From Location;


Left Join(MainTable)

Load

ID,

DATE(MAX(LoginDate)) as MaxLoginDate

Resident MainTable

Group By ID;

4 Replies

Re: Add max date field

May be this

Fact:

LOAD ID,

     Date,

     OtherFields

FROM ...

Left Join (Fact)

LOAD ID,

     Max(Date) as [Latest Date]

Resident Fact

Group By ID;

Re: Add max date field

May be this?

Left join to fact

Load *, Max(Date) as MaxDate

Resident Fact

Group By <Non Aggr Dimensions>;

Life is so rich, and we need to respect to the life !!!

Re: Add max date field

Here i need to ask if you have LoginDate in your table it self then try with


MainTable:

Load

ID,

LoginDate,

...

From Location;


Left Join(MainTable)

Load

ID,

DATE(MAX(LoginDate)) as MaxLoginDate

Resident MainTable

Group By ID;

pallesen
New Contributor II

Re: Add max date field

Thanks guys! All three answers were very helpful 

In the end Anand came closest to the solution which I could use directly in my code, so I will mark his answer as correct.

Thanks again.

Community Browser