Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
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
Highlighted

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;

View solution in original post

4 Replies
Highlighted

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;

Highlighted

Re: Add max date field

May be this?

Left join to fact

Load *, Max(Date) as MaxDate

Resident Fact

Group By <Non Aggr Dimensions>;

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted

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;

View solution in original post

Highlighted
Contributor II
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.