How can I modify the below dates so that the year is dynamic but formatting stays the same?
Solved! Go to Solution.
Tried to make as simple as possible and as dynamic as possible.
try this script. when the date changes to 1/1/2019 automatically you'll be having all the dates for 2019.
check out the attached too.
let vYear = year(today());
for i = 1 to 12
load '[' & Date(Date#($(i) & '/1/' & $(vYear),'mm/dd/yyyy'),'mm/dd/yyyy') & ']'as Date
I've used the MakeDate() function and the Year() function to create values like that, by being able to specify the pieces of the final date you desire. For your example, you can do the following:
MakeDate(Year(Now()), 1, 1) // 01/01/2018
MakeDate(Year(Now()), 2, 1) // 02/01/2018
MakeDate(Year(Now()), 3, 1) // 03/01/2018
Because you have the Year() function as well, it will calculate based on current year.
I'm unsure... you might try assigning each to a variable that you can call.
Are you pulling these values from some base data to generate them dynamically? Is there a table or another source that you're relying on for your cross table?
I'm pulling from an excel file with the dates as columns:
Is it possible that you don't need to modify the dates since they are provided by the Excel file? Meaning, that file is already dynamic, and you won't need to modify your results because they come into Qlik as you need them?