Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Variable Date from Calendar

Hi All,

I have an app that has several calendars, and I am trying to create a variable based on a month date from that calendar date.  Everything that I can find so far seems to be a variable based on set dates, or other formulas such as Today(). 

What I'm looking for is essentially just the current OppMonthYear, less one month.

Calendar.JPG

Can this be done?

7 Replies
sunny_talwar

Not entirely sure what you mean. But may be this:

Temp:

LOAD Date(AddMonths(Max(OppMonthYear), -1)) as NeededOppMonthYear

Resident Opp_Calendar;

SET vNeededOppMonthYear = Peek('NeededOppMonthYear');

DROP Table Temp;

Anonymous
Not applicable
Author

Sunny,

You're on the right track regarding what I'm looking for.  However that script seems to return only a text value of Peek('NeededOppMonthYear');

sunny_talwar

What about this:

Temp:

LOAD Num(AddMonths(Max(OppMonthYear), -1)) as NeededOppMonthYear

Resident Opp_Calendar;

SET vNeededOppMonthYear = Peek('NeededOppMonthYear');

DROP Table Temp;

Not applicable
Author

Hi Dan, try this:

Temp:

LOAD Num(AddMonths(Max(OppMonthYear), -1)) as NeededOppMonthYear

Resident Opp_Calendar;

SET vNeededOppMonthYear = Peek('NeededOppMonthYear' , 0 , Temp);

DROP Table Temp;


I hope that it help you! ifnot just ask us!


Agustin

Anonymous
Not applicable
Author

Same thing.  It seems that the Peek is not coming back as a function.

Anonymous
Not applicable
Author

Capture.JPG

Same thing as before. It seems that in both yours and Sunny's scrip it's not picking up the PEEK as a function.

sunny_talwar

I think i understand what you are trying to do. But the question is are you going to be using this variable in the script? because if you do, then you cannot use functions in scripts, you would need to change it to a static value. If this is for front end (and will change based on selections) then why don't you create this on the front end itself?