Customers vs Categories Cube
Top 5 customers with sales by categories
->pipe(new SuperCube(array(
"row" => "customerName",
"column" => "productLine",
"sum" => "dollar_sales"
)))
Customers | Total | Vintage Cars | Classic Cars | Trucks and Buses | Trains | Ships | Planes | Motorcycles |
Euro+ Shopping Channel |
$820,690 |
$128,182 |
$376,073 |
$99,157 |
$28,045 |
$62,564 |
$73,212 |
$53,457 |
Mini Gifts Distributors Ltd. |
$591,827 |
$145,009 |
$262,082 |
$113,971 |
$17,965 |
$28,851 |
$0 |
$23,948 |
Australian Collectors, Co. |
$180,585 |
$31,029 |
$48,010 |
$16,327 |
$0 |
$0 |
$35,205 |
$50,014 |
Muscle Machine Inc |
$177,914 |
$13,310 |
$134,060 |
$26,218 |
$4,326 |
$0 |
$0 |
$0 |
La Rochelle Gifts |
$158,573 |
$12,274 |
$25,319 |
$24,623 |
$0 |
$14,799 |
$39,361 |
$42,198 |
The report demonstrate the use of `Cube` package to analyze data. The raw data is pulled from CSV file containing customer name, product category and the sale amount. Those data after is piped through `Cube` process will be turn to 2 dimension table in which row will be group by customer name, column is grouped by product category and data cell is the amount that customer purchased a specific product category.
Cube can be considered a simple version of Pivot Tables that you see in Excel or any Speadsheet application. The different between Cube and Pivot is the number of dimension they handle. While Pivot can handle more than 2 dimension and support hierachial demension, `Cube` support only 2 dimensions and single level of dimension. Although it sounds simple but according to our observation, 70% cases `Cube` is enough.
Because of the simplicity, the power of `Cube` process lie on its speed to handle data compared to Pivot.