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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
DexterAlex
Contributor
Contributor

Calculating a variable from an input field?

I am sure I am missing something very straightforward, so some assistance would be appreciated.  In my load script I load a master calendar, Which has a range of dates corresponding to the range of dates in the transaction file, plus the number of the week in the year. The date links to a date field in the transaction file I am loading.  I want the user to enter a date (any date in the range of the master calendar) which I store in a variable I called 'vInputDate'. Based on the date the user enters I want to assign a variable the corresponding value of the week variable. 

So if the user enters 12/12/2020, I want the week variable to reflect 50, and if the user enters 16/12/2020 I want the week variable to reflect 51. This needs to be done dynamically as the user can select whichever date he wants to report on.

1 Reply
Vegar
MVP
MVP

Try something like this. 

Set vWeek=Week(date#('$(vInputDate)', 'DD/MM/YYYY'))