Day of Year Value

I am trying to figure out how to do the following by leveraging the below from a mysql datasource

I understand that this value will be thrown off if it is being passed for the prior year (this is for a single stat box)

select dayofyear(now()) - count(distinct field) as value from XYZ

where now() is one of the below fields

  • $__time(column) -> UNIX_TIMESTAMP(column) as time_sec
  • $__timeFilter(column) -> UNIX_TIMESTAMP(time_date_time) ≥ 1492750877 AND UNIX_TIMESTAMP(time_date_time) ≤ 1492750877
  • $__unixEpochFilter(column) -> time_unix_epoch > 1492750877 AND time_unix_epoch < 1492750877
  • $__timeGroup(column,‘5m’) -> cast(cast(UNIX_TIMESTAMP(column)/(300) as signed)*300 as signed)

Anyone willing to lend a hand here on this? Please?