Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Can someone post a script to generate random sales data in qlikview...
What i need is
Customer Name,
Invoice Date
Invoice Value
Invoice Number.....etc
Just replace the factor for RAND() function with the number of days in your interval:
Date(makedate(2012,1,1)+floor(RAND()*(makedate(2013,12,31)-makedate(2012,1,1)+1))) as InvoiceDate,
Hi Manish,
You can make up the data using QlikView functions like Rand(), Autogenerate and other Date functions. Something like this...
LOAD
Floor(Rand() * 10000) AS [Invoice Value]
AutoGenerate 10;
You can add whatever you need for [Customer Name]. Or you can also check this website where you can find loads of free data.
http://www.infochimps.com/tags/sales
Cheers,
DV
Use Shortcut key Ctrl +Q in Script Editor.... Random Load code will be generated...and then modify it as required...
Thanks,
Selva
You can use the RAND() function to generate random values:
LOAD
'Customer'&Ceil(RAND()*100) as CustomerName,
Date(makedate(2012)+floor(RAND()*(2*365+1))) as InvoiceDate,
round(RAND()*1000+50,10) as InvoiceValue,
recno() as InvoiceNo
autogenerate 1000;
Thanks for your reply.
Can you specify below
floor(RAND()*(2*365+1)))
Is there any speciallogic of 2*365+1?
Edit : also what if I need dates between 01/01/2012 to today?
No, no special logic. It just creates values in the range of 2 years including a leap year (to add upon start date 2012 Jan 1st).
What if I need to create random dates between two specific dates?
Just replace the factor for RAND() function with the number of days in your interval:
Date(makedate(2012,1,1)+floor(RAND()*(makedate(2013,12,31)-makedate(2012,1,1)+1))) as InvoiceDate,