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

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
ananth
New Member
New Member

Setting Date variables

I want to create two date variables. First one, which is the maximum date based on a condition location=Dallas and another variable which is 12 months before the max date. How do I do it on this?

Labels (1)
2 Replies
robert_mika
Master III
Master III

In script: 

Temp_MaxDate:
LOAD
Max(DateField) as MaxDate
RESIDENT (YourExistingTable)
WHERE Location = 'Dallas';


LET vMaxDateDallas = Peek('MaxDate', 0, 'Temp_MaxDate');


LET v12MonthsBefore = MonthStart(AddMonths(vMaxDateDallas, -12));

Vegar
MVP
MVP

=dayname(Max({1<Location={'Dallas'}>} DateField))

 

=addyears(Max({1<Location={'Dallas'}>} DateField),-12)