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

Max Date in Script Variable

Hi,

I am using the variable

eMarginToday = SUM({$<Datum={"$(=Date(Max(Datum)-1))"}>}Margin)

in my qvw and it is working as expected. Now I wanted to move the definition of the variable to the script

SET eMarginToday = (SUM({$<Datum={"$(=Date(Max(Datum)-1))"}>}Margin));

but when the script is reloaded the variable looks like this in the variable editor: (SUM({$<Datum={""}>}Margin))

Any idea how I could prevent that?

Kind Regards,

Nigel

1 Solution
4 Replies
balabhaskarqlik

Try like this:

Orders:

Load

    *

From Orders.csv;

Dates:

LOAD

     max(ORDERS_DT) as MaxDate,

     min(ORDERS_DT) as MinDate

Resident ORDERS;

LET vMaxDate = Peek('MaxDate',0,'Dates');

LET vMinDate = Peek('MinDate',0,'Dates');

DROP Table Dates;

TIMEDIM:

LOAD

     Date($(vMinDate) + (IterNo()-1)) as Date

Autogenerate 1

while $(vMinDate)+ (IterNo()-1)<= $(vMaxDate);

nigel987
Creator II
Creator II
Author

Hmm.. you are generating a calendar between min and max date... This is not really what I was asking for, but maybe my question is unclear. I want to define the above mentioned variable already in the script.

nigel987
Creator II
Creator II
Author

Thanks Sunny,

in the meantime I tried Stop Dollar Sign Expansion in the script (Escape Character ??? ) and this worked for me!