Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good Evening,
I want to run a report that will give me range in Total Sales of a customers, for example i should be able to click a price filter and get customers that falls under that category. The script below is what i used to determine how old an item is in my stores.
LOAD *,
If(NDay < 32, Dual('1 Month', 1),
If(NDay < 91, Dual('3 Months', 2),
If(NDay < 181, Dual('6 Months', 3),
If(NDay < 361, Dual('12 Months', 4),
If(NDay < 541, Dual('18 Months', 5),
If(NDay < 621, Dual('24 Months', 6),Dual('Over 2 Years', 7))))))) as DayRange;
LOAD *,
Today() - FIRST_RCVD_DATE as NDay;
Which worked very fine i tried to apply the same method but not getting anything similar to the Result i need
LOAD *,
If(totSales < 35000, Dual('Star', 1),
If(totSales < 60000, Dual('Super', 2),
If(totSales < 100000, Dual('Gallant', 3),
Dual('Poor', 7))))as SalesPrice;
LOAD *,
INVC_PRICE as totSales;
Any help please
Hi Omotayo,
What you seem to be missing is a finalizing statement for your load
such as
Resident [Table Name]
From [File]
Autogenerate(1) or so on to finish the load.
By doing something like:
LOAD *,
If(totSales < 35000, Dual('Star', 1),
If(totSales < 60000, Dual('Super', 2),
If(totSales < 100000, Dual('Gallant', 3),
Dual('Poor', 7))))as SalesPrice;
LOAD
rand()*(1000000-35000) as totSales //just random numbers so that it's possible to see different categories
AutoGenerate(10);
works alright.
Hope it helps,
Felipe.
How is values looks for INVC_PRICE
This makes my values to zero.