Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
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
LOAD *,
Date(StartDate-Ceil(RAND()*150)) as RandomDate
LOAD StartDate
FROM ...;
Something like this:
LOAD Date(Today() - Ceil(Rand() * 150)) as Date
Replace Today() with your Start Date
Hi Michael,
Try like this:
let vStartdate= num(today());
Temp_date:
load date($(vStartdate)+rowno()-1) as New_Date
AutoGenerate 150;
or
let vStartdate= num(today());
Temp_date:
load date($(vStartdate)+Ceil(Rand() * 150)) as New_Date
AutoGenerate 150;
Regards
KC