Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
viveksingh
Creator III
Creator III

Get max date data

Hi every one,

i have a date field like below in qvd

DATE
31/08/2018 12:00:00 AM
30/09/2018 12:00:00 AM

I want load only maximum data that has max date. i.e.., want to load only 30/09/2018 only.

14 Replies
viveksingh
Creator III
Creator III
Author

Hi,

Below is sample data,

lets assume the data is in qvd,

Expecting:

I'm able to convert date into number and max value in variable, when I use it in where condtion. it is throwing error. Looksa like I'm missing some syntax kind of thing.

viveksingh
Creator III
Creator III
Author

please help on this

nasirsaikh
Creator
Creator

Simple is below one

Last_Updated_Date:

Load Max(YourDate) as Upload_Date

From [lib://QVD_INT (toi-bi_administrator)/TableName.qvd](qvd);

Let vMax_Date = date(PEEK('Upload_Date', 0, 'Last_Updated_Date'), 'YYYY-MM-DD');

Drop Table Last_Updated_Date;

sujan24s
Contributor III
Contributor III

Hi,

    You Want Same Like ThisCapture.JPG

trdandamudi
Master II
Master II

Here is the code and the output:

Data:
Load * Inline [
Name,Dept,Sal,Date
ABC,IT,100,1/10/2018
ABC,IT,101,2/10/2018
DE,IT,150,1/10/2018
DE,IT,151,2/10/2018
JK,HR,80,1/10/2018
JK,HR,81,2/10/2018
]
;

Right join (Data)
Load Name,
FirstValue(Date) as Date
Resident Data
Group by Name
order by Date desc;

Hope this helps...