Forum Discussion

Sof's avatar
Sof
Frequent Visitor
9 years ago
Solved

Average where not all values are present

I have two columns, one with date-time values rounded to the hour and one an ID that is present at that time. This looks like: DATETIME                         ID 2015-01-06 15:00:00        1 2015...
  • Sof's avatar
    Sof
    9 years ago

    The problem is that there is no dataline when no ID is present. I solved it by not using the standard average function, but by calculating the average using the DATEDIFF to calculate the number of DATETIMEs in the interval between MIN(DATETIME) and MAX(DATETIME).