Skip to Main Content
Spotfire Ideas Portal
Status Future Consideration
Product Spotfire
Categories Visualization
Created by Guest
Created on Feb 6, 2016

Rolling Average based on specified number of day difference.

Customer want to calculate the rollowing average based on 14 days difference.Below is the details shared by customer:-

I would like to calculate a Rolling Average for a particular field for the last 14 days. There is not an entry for every day in the table, so there are missing days. I would like the Rolling Average to only calculate on days that are within the 14 days, so if I have 2 entries in the last 14 days, it should just be the average of those 2 days.

The calculation I'm trying to use is as follows

Avg([Value]) OVER (LastPeriods(14,[Date])

where "Value" is the field I want to return and Date is the column that has the date of the record.

When I do this, the calculation looks back over the last 14 records and returns an average of those, instead of the last 14 days and just including data from those records.

  • Attach files