Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Raju_6952
Creator III
Creator III

max value of Modified date

Hi, 

I have data in the following manner, the request to load only value for the max (modified date) or latest modified date.

 

Raju_6952_0-1704879477718.png

Please let me know if any suggestions.

Labels (2)
12 Replies
Parthiban
Creator
Creator

Hi,

First load the table and then take max(modified_Date) and store that field in the vaiable using peek function.

and then you load the original script and use where condition modified_date=$(variable).

Then you will get max date data in your script.

Raju_6952
Creator III
Creator III
Author

I tried this way but giving blank value for other fileds except primary key.

Parthiban
Creator
Creator

Hi,

Cross check the data format in where condition

Anil_Babu_Samineni

@Raju_6952  how about this?

mytable:

Load *, Modifieddate From <<YourTable>>;

minmax:

LOAD

  min(Modifieddate) as MinDate,

   max(Modifieddate) as MaxDate

RESIDENT mytable;

LET vMinDate = peek('MinDate'); // This is to capture the minimum date

LET vMaxDate = peek('MaxDate); // This is to capture the maximum date

DROP TABLE minmax;

Final_mytable:

NoConcatenate

Load * Resident mytable where Date(Modifieddate)=Date('$(vMaxDate)');

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Raju_6952
Creator III
Creator III
Author

Hi @Anil_Babu_Samineni ,

Tried this but no use.

Thanks,

Raju

Rohan
Partner - Specialist
Partner - Specialist

Hi @Raju_6952 ,

Try this :

DateMap:

Mapping load *;

Load PrimaryKey,max(date(date#(ModifiedDate,'DD.MM.YYYY'))) as Max

Resident Data group by PrimaryKey;

Noconcatenate

Final:

Load *

Resident Data where date(date#(ModifiedDate,'DD.MM.YYYY'))=Applymap('DateMap',PrimaryKey,'N/A');

Drop table Data;

 

Regards,

Rohan.

Anil_Babu_Samineni

@Raju_6952  When you say no use, IS this you mean failed? or, Data not coming as expected or what is exact issue?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Raju_6952
Creator III
Creator III
Author

Hi @Anil_Babu_Samineni ,

I am not getting the correct values.

Thanks,

Raju

Anil_Babu_Samineni

@Raju_6952 Please share sample dataset and expected result?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful