Ordered list to create a hierarchical dimension
dim_hierarchy(...)
... | Ordered set of measures names |
---|
retail_orders %>% pivot_rows(order_date = dim_hierarchy( year = as.integer(format(orderdate, "%Y")), month = as.integer(format(orderdate, "%m")) )) %>% pivot_values(sum(sales))#> sum(sales) #> 2003 3516979.54 #> 2004 4724162.6 #> 2005 1791486.71