Current full period quarter over previous full period quarter

Usage

qoq(
  .data,
  .date,
  .value,
  calendar_type = "standard",
  lag_n = 1,
  fiscal_year_start = 1
)

Arguments

.data

tibble or dbi object (either grouped or ungrouped)

.date

the date column to group by. Must be a Date or POSIXt type.

.value

the value column to summarize. Must be numeric.

calendar_type

select either ‘standard’, ‘445’, ‘454’, or ‘544’ calendar, see ‘Details’ for additional information

lag_n

the number of periods to lag

fiscal_year_start

integer 1-12, the month the fiscal year starts nearest to (default 1 = January). Only used with retail calendars (‘445’, ‘454’, ‘544’).

Value

ti object

See Also

Other time_intelligence: atd(), dod(), mom(), momtd(), mtd(), mtdopm(), pmtd(), pqtd(), pwtd(), pytd(), qoqtd(), qtd(), qtdopq(), wow(), wowtd(), wtd(), wtdopw(), yoy(), yoytd(), ytd(), ytdopy()

Examples

qoq(contoso::sales,.date=order_date,.value=quantity,calendar_type='standard',lag_n=1)
#> 
#> ── Quarter over quarter ────────────────────────────────────────────────────────
#> Function: `qoq` was executed
#> 
#> ── Description: ──
#> 
#> This creates a full quarter `sum()` of the previous quarter quantity and
#> compares it with the full quarter `sum()` current quarter quantity from the
#> start of the standard calendar quarter to the end of the quarter
#> 
#> ── Calendar: ──
#> 
#> • The calendar aggregated order_date to the quarter time unit
#> • A standard calendar is created with 0 groups
#> • Calendar ranges from 2021-05-18 to 2024-04-20
#> • 222 days were missing and replaced with 0
#> • New date column date, year, quarter was created from order_date
#> ── Actions: ──
#> ✔Aggregate
#> ✔Shift 1 quarter
#> ✔Compare previous full quarter
#> ✖Proportion of Total
#> ✖Count Distinct
#> 
#> ── Next Steps: ──
#> 
#> • Use `calculate()` to return the results
#> ────────────────────────────────────────────────────────────────────────────────
#>