Builds a date hierarchy dimension

dim_hierarchy_mqy(x)

Arguments

x

A date variable

Details

Helper function that creates the unevaluated code that creates the year, quarter and month on the fly.

Examples

retail_orders %>% pivot_columns(order_date = dim_hierarchy_mqy(orderdate)) %>% pivot_values(n()) %>% pivot_drill(order_date)
#> 2003 2004 2005 #> 1 2 3 4 1 2 3 4 1 2 #> 14 19 19 52 25 28 34 57 36 23