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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
SebastianCA
Contributor
Contributor

BUG: using variables in auto calendar

Before February 2023, the auto calendar code for one app worked as expected, but after one update in the system it stopped giving the desired result in one of the fields. After some research, I've found the issue is the usage of a variable inside the auto calendar.

 

We have one variable to know when the app was opened:

let vL.ReferenceDate = monthstart(today(2)); 

 

The variable is later used to calculate the offset of FY:

year(yearstart(($1), 0, 4)) - year(yearstart((vL.ReferenceDate), 0, 4)) as FY_offset

 

The workaround for the issue was to remove the variable and do a direct calculation of the date:

(year(yearstart(($1), 0, 4)) - year(yearstart(monthstart(today(2)), 0, 4))) as FY_offset,

 

Even though this works now, there's another case with the same issue where  we need the latest date of the data which we peek from another table:

Last_Date:

Load

monthstart(date(max(invoice_mth))) as MAX_DATE

Resident REVENUE;

LET vMAX_invoice_mth = peek('MAX_DATE', 0, Last_Date);

 

Unfortunately, we can’t replace the variable with calculation directly as Qlik can’t use peek function there, so the workaround doesn't work.

 

Any idea of why this is happening? Code for the auto cal is attached.

Labels (4)
0 Replies