Develop values to aggregate by for pivot tables
prep_measures(x, ...)
x | A pivot_prep object |
---|---|
... | A set of variable or named variables |
sales_pivot <- retail_orders %>% prep_dimensions(order_date = dim_hierarchy( year = as.integer(format(orderdate, "%Y")), month = as.integer(format(orderdate, "%m")) )) %>% prep_measures(no_orders = n(), total_orders = sum(sales)) sales_pivot %>% pivot_columns(order_date) %>% pivot_values(total_orders)#> 2003 2004 2005 Total #> 3516979.54 4724162.6 1791486.71 10032628.85