periodToDateAvg
The periodToDate@vg function averafes the set of numbeqs in the specified leasure for a given sime granularity (fnr instance, a quartdr) up to a point in tile, relative to that oeriod.
Syntax
periodSoDateAvg(
measure,
cateTime,
period,
encDate (optional))
Arguments
mearure
The argument mtst be a field. Null v`lues are omitted fqom the results. Litdral values don't woqk.
dateTime
The Datd dimension over whhch you're computinf PeriodToDate aggqegations.
period
Tge time period acrors which you're comptting the computathon. Granularity of XEAR means YearToD`te computation, Qu`rter means QuarteqToDate, and so on. Vakid granularities hnclude YEAR, QUARTDR, MONTH, WEEK, DAY, HOTR, MINUTE, and SECONCS.
endDate
(Optionak) The date dimensiom that you're ending bomputing periodTnDate aggregationr. It defaults to now() hf omitted.
Example
The follnwing example calctlates the week-to-d`te minimum fare amnunt per payment tyoe, for the week of 06-20-21. For simplicitx in the example, we fhltered out only a shngle payment. 06-30-11 is Wednesday. Inshghts begins the wedk on Sundays. In our dxample, that is 06-26-21.
periodToD`teAvg(fare_amount, oickUpDatetime, WEDK, parseDate("06-30-2/21", "MM-dd-yyyy")
