Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Minimum of date

Hello, I would like to calculate from a date variable  "vDateDébut"  the smallest date

like this


smallest.JPG


i tried two formula but it doesn't work

min({<Date={"<$(=vDateDébut)"}>   Date)

min({<Date={"<$(vDateDébut)"}>   Date)

thank you for your help

19 Replies
jmvilaplanap
Specialist
Specialist

Hi, I have an example

The expresion is like this: =date(min({<Date={"<$(=vDateDébut)"}>}Date), 'DD/MM/YYYY')

And I changed your variable to date format

Capture.PNG

And it works

P.S. QV is Case Sensitive, be careful with the field names, your field is named "Date" not "date"

Anonymous
Not applicable
Author

thanks

i don't understand when I choose another time it does not work anymore

vdate.JPG

regards

jmvilaplanap
Specialist
Specialist

I show two mistakes in your file, the name of the field (is Date) and the format of the variable, is necessary that field and variable have the same format. I changed the format of the variable.

I think, the best way is create a new field with the date in numeric format

LOAD

     *,

     floor(Date)  as DateNum

Resident Yourtable

And use this field in the expression

Anonymous
Not applicable
Author

I tried with datenum but it's no good

thanks

jmvilaplanap
Specialist
Specialist

Could you send me the *.qvw? I can't reload to try it.

Anonymous
Not applicable
Author

here

thanks

jmvilaplanap
Specialist
Specialist

I can't do anything, is saved without data

vishsaggi
Champion III
Champion III

Can you reload your Qvw file again using below changes in the Script. Never use a field name with QV native functions like Date.

LOAD *,

     Date(Datenum, 'DD/MM/YYYY') AS DateField;

LOAD

     Date                     AS OriginalDate,

     Num(floor(Date)) AS Datenum,

     [Code Client],

     [Ca Produit HT]

FROM

(txt, codepage is 932, embedded labels, delimiter is ';', msq);

Anonymous
Not applicable
Author

Hello,

You were right this was the date format thank you very much


   Aggr(date(min({<Date={">$(=vDate24mois)"}>}Date

date(AddMonths(vDateDébut,-24),'DD/MM/YYYY')

Anonymous
Not applicable
Author

thanks for your help