Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
KingsleyJH
Partner - Contributor III
Partner - Contributor III

Add months and years in Qlik Application Automation?

Hi all.

 

How do you do more sophistcated date calculations like monthstart, addmonths, monthend, yearstart, addyears and yearend (just a few examples).

I can't find any documentation on this.

 

Many thanks

Kingsley

Labels (3)
1 Solution

Accepted Solutions
Emile_Koslowski
Employee
Employee

Hi Kingsley,

These are Qlik Sense calculations, they are unrelated to Qlik Application Automation.

If you want to learn more about date functions in Qlik Cloud, see Qlik Cloud - Date and time functions

If you want to edit dates inside automations, I suggest you use the date formula, see Qlik Application Automation - Date functions

Kind regards,

Emile

 

View solution in original post

4 Replies
Emile_Koslowski
Employee
Employee

Hi Kingsley,

These are Qlik Sense calculations, they are unrelated to Qlik Application Automation.

If you want to learn more about date functions in Qlik Cloud, see Qlik Cloud - Date and time functions

If you want to edit dates inside automations, I suggest you use the date formula, see Qlik Application Automation - Date functions

Kind regards,

Emile

 

KingsleyJH
Partner - Contributor III
Partner - Contributor III
Author

Hi Emile.

 

Thanks for your video on QAA and showing how to store as QVDs. This automation that you and the team have done is super helpful!

 

Following your tutorial, I'm using the now function in the automation, but our billing months are from 26th - 25th of the following month. I'm essentially trying to store what month it is in a variable so I can make a selection on a field in an app. Here are examples:

if now = 25 May 2022. Output = 2022/05

if now = 26 May 2022. Output = 2022/06

if now = 13 June 2022. Output = 2022/06 etc

I understand that the code I presented was not correct for automation but I'm looking for how I can do that in QAA. In normal QS Load script it would look like:

let vCurrentMonth = date(addmonths(monthstart(today()-26), 1), 'YYYY/MM') 

 

Any ideas how I can replicate that in QAA?

 

Many thanks

Kingsley

Emile_Koslowski
Employee
Employee

Hi Kingsley,

Could you try the following? First, use a condition block to validate whether or not the current date is in the correct month. If it is, use the current month. If not, use the current month + 1 month.

Emile_Koslowski_0-1652885682822.png

 

Please note that the datetime format that Qlik Sense uses internally is not yet supported in automations. You can work around this by using the Select Field Value By Query block to make selections by the textual representation of a date (instead of the numeric representation which is not yet supported).

Kind regards,
Emile

 

Antony3
Contributor II
Contributor II

Hi Emile,

I stumbled on this post and it helped me fix something I was working on.

In your screenshot you wrote {date: 'last month','Y/m'}. Where can I find more information on the 'last month' bit? What is it called and what other things can I write such as now, last month etc? If so is there a list somewhere similar the Date functions link?