Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
vongalaprashant
Contributor III
Contributor III

How to display latest year?

Hi All,

I have a small issue.

I have two filters one is  from-date and to-date ,when I select this two dates for particular field say project I should get the latest data related to project.

ex:

project-name ,data

project A ,nov-2017

project A,jan-2018

project B,dec-2017

project B,jan 2018

project C,jan 2017

this is my data if i select filter nov-2017 to dec-2018  then for project A The latest data was updated on jan-2018.how can I achieve when i select filter I shoud get the latest month of the project.?

please help me:)

Thanks in advance.

1 Solution

Accepted Solutions
vongalaprashant
Contributor III
Contributor III
Author

Hi All,

Thanks for your replies.I need a small favour here :

As you uys said I seperated month and year In above example,if I select nov-2015 to dec-2018 as filter .

I am getting latest year for project A that is 2018.but I need latest month also the latest month is Jan.


If I use max(month(data)) it retuns dec , but I need jan.


Thanks in advance.

View solution in original post

7 Replies
arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Prashantji,

may be like below:

Date(max(Date#(data,'MMM-YYYY')),'MMM-YYYY')

Thanks,

Arvind Patil

buzzy996
Master II
Master II

convert ur data of date format something like 01/urmonth/year and pull max date from this format.

zebhashmi
Specialist
Specialist

Max(aggr(date,project-name)

zebhashmi
Specialist
Specialist

or

aggr(max(date),project-name)

Chanty4u
MVP
MVP

try this

A:

LOAD * INLINE [

    project-name, data

    project A, nov-2017

    project A, jan-2018

    project B, dec-2017

    project B, jan 2018

    project C, jan 2017

];

LOAD

*,Date(max(Date#(data,'MMM-YYYY')),'MMM-YYYY')  as new

Resident A

Group by "project-name",data;

vongalaprashant
Contributor III
Contributor III
Author

Hi All,

Thanks for your replies.I need a small favour here :

As you uys said I seperated month and year In above example,if I select nov-2015 to dec-2018 as filter .

I am getting latest year for project A that is 2018.but I need latest month also the latest month is Jan.


If I use max(month(data)) it retuns dec , but I need jan.


Thanks in advance.

tresesco
MVP
MVP

Try month() as the outermost function like:  = Month(Max(data))