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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
mhmmd_srf
Creator II
Creator II

Max date is not working

Hi All,

I want to retrieve the max date from a QVD. Date is in YYYY-MM-DD HH:MM:SS format. Below is my code:

Master:

LOAD

   *

FROM [lib://IT Standard Metrics/QVD\Combined_Result.qvd]

(qvd);

Max:

load ([sys_updated_on]) as [Max_sys_updated_on]

resident Master    ;

Let  vMax = peek('[Max_sys_updated_on]',0,'Max');

However vMax is not populating anything.

Could you please help me on this?

Thanks,

Sarif

12 Replies
miskin_m
Partner - Creator
Partner - Creator

HI Sarif,

First check whether the Max table is loading properly with proper values in Max_sys_updated_on. Also you can apply date function while loading the Max table with [sys_updated_on].

giakoum
Partner - Master II
Partner - Master II

Max:

load max([sys_updated_on]) as [Max_sys_updated_on]

resident Master    ;

Let  vMax = Fieldvalue('Max_sys_updated_on', 0);

mhmmd_srf
Creator II
Creator II
Author

this is also not working... my set expression in chart is :

count ({$<[sys_updated_on] = {'$(=$(vMax)'}>}number)

puttemans
Specialist
Specialist

Please try below. You rename your variable into a max, but you're not taking the max, as you're taking the first value of Max_sys_updated_on in the 'Max' table. By sorting the table so that the highest date comes first, you will select the max.

Master:

LOAD

   *

FROM [lib://IT Standard Metrics/QVD\Combined_Result.qvd]

(qvd);

noconcatenate

Max:

load ([sys_updated_on]) as [Max_sys_updated_on]

resident Master

order by [sys_updated_on] desc;

Let  vMax = peek('[Max_sys_updated_on]',0,'Max');

mhmmd_srf
Creator II
Creator II
Author

this is also not working sir...

santiago_respane
Specialist
Specialist

Hi,

maybe something like this:

//Load data from QVD

Master: LOAD * FROM [lib://IT Standard Metrics/QVD\Combined_Result.qvd] (qvd);

//Get max from sys_updated_on field

Max:

noconcatenate

load MAX([sys_updated_on]) as [MaxValue] resident Master;

//Assign max value to variable

Let  vMax = peek('[MaxValue]',0,'Max');

Please let me know if this helps.

Kind regards,

mhmmd_srf
Creator II
Creator II
Author

this is also not working...Santiago

santiago_respane
Specialist
Specialist

Please can you share a sample app or some snapshots, the code provided should work.

Maybe there's a formatting issue when comparing in your expression, it would be easier if you could share a little bit more.

Have you verified you variable value after the scripts run? does it have the correct value?

Kind regards,

rupamjyotidas
Specialist
Specialist

Try this

Max:

noconcatenate

load MAX([sys_updated_on]) as [MaxValue] resident Master order by [sys_updated_on] desc;

//Assign max value to variable

Let  vMax = peek('[MaxValue]',0,'Max');

But a Sample would be helpful