Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bhavvibudagam
Creator II
Creator II

Max Date and Min Date from Date Format

Hi Everyone,

I have a date field in Number format like original date below.I have converted that number format date to DD-MM-YY Format date like below with below script.

Date(Remedy_Date,'DD-MM-YY') AS Remedy_Date,

In the text box I have taken the max date like  '$(=Max([Remedy_Date]))' then I got the correct date as 09-09-17.

But while taking Min date like '$(=(Max([Remedy_Date])-1))' getting number format and wrong number also.

Please help me on Min date.

Thanks in advance

11 Replies
its_anandrjs

Then try this in text box

'$(=Date (Max([Remedy_Date])-1))'


'$(=Date (Min([Remedy_Date])-1))'


Anil_Babu_Samineni

When you talk about Min date it should min, Right? '$(=(Min([Remedy_Date])))'


And for your question, Because of -1 it it reverting to Number format so then you should use this

'$(=(Date(Max([Remedy_Date])-1,'DD-MM-YY')))'

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
Not applicable

for minimum date take

'$(=Min([Remedy_Date]))'

its_anandrjs

Sorry wrong suggestion it will be MIN not MAX

'$(=Date (Min([Remedy_Date])-1))'

mostwanted123
Creator
Creator

Hi Bhavani,

Try this,

'$(=Date (Min([Remedy_Date])))'


Regards,

Pratik Bhor

bhavvibudagam
Creator II
Creator II
Author

Hi Anil

Thanks for you reply. Actually I am expecting second max date. I have tried like the expression you have provided.

But I am getting 08-09-17 not 08-08-17

Anil_Babu_Samineni

What if you are written this? '$(=(Max([Remedy_Date], 2)))'

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
Kushal_Chawda

try below

=FirstSortedValue ([Remedy_Date],-[Remedy_Date],2)

its_anandrjs

In any text object how you can use Max([Remedy_Date], 2) you need to aggregate then by your fields then you get the output or you can do this in the loading script.

Fact:

Load

[Remedy_Date],

...

...

From Source;

MaxMinDates:

Load

[Remedy_Date],

Min([Remedy_Date])  as MaxDate,

Max([Remedy_Date])  as MaxDateOne,

Max([Remedy_Date],2)  as MaxDateTwo

From Source

Group By [Remedy_Date];


And then use this fields in UI part.


Hope this helps you