How to make a gauge in Perspective show an averaged value?

I have a gauge on a Perspective display that has the value bound to a modbus data point I'm grabbing from a sensor. This sensor happens to be a wind direction sensor that bounces around a lot. For that reason, I'd really like to use an average of the past 5 seconds or 10 second of data for the value that is represented by the gauge.

I can figure out how to point the value at a Tag History type binding, using simple averaging, to return this value, but that generates a dataset or a document. The gauge type widget doesn't like those objects, and wants a raw numerical value.

How do I get a gauge (or other widget that expects a simple numerical value) to use an average of the last bunch of values from a Tag History query? I can't seem to figure out how to do this. Any help would be very appreciated.

1 Like

If you make a custom property with a tag history binding returning a dataset, you can then bind the value to mean({this.custom.key},1)

Thank you thank you thank you! This worked wonderfully!