Convert Timeseries to int value in metric


I have a field of type int which is exposed as a SimpleMetric for the use in a couple of CompoundMetrics. One of these CompoundMetrics needs to be able to use this value as the inputSpan parameter of the window() ExpressionEngineFunction. When I try to use the metric as-is, I get an error saying

Error: Internal error: can’t infer value type for expression

When I hard-code an integer value in place of that, it works ok. Is there a way to extract a single value from a Timeseries as an int value?