Discussion Board for collaboration on QlikView Scripting.
How to generate a random date in a 150 day range before a Start Date?
I believe I can use the Rand() function but I am not sure how to set it so that from the Start Date field it can generate any date 150 before the start date.
Any help please?
Maybe something like
Date(StartDate-Ceil(RAND()*150)) as RandomDate
Something like this:
LOAD Date(Today() - Ceil(Rand() * 150)) as Date
Replace Today() with your Start Date
Try like this:
let vStartdate= num(today());
load date($(vStartdate)+rowno()-1) as New_Date
load date($(vStartdate)+Ceil(Rand() * 150)) as New_Date