Heatmap query configuration

Is there a way to configure a heatmap so that on the X-axis, my time variable is grouped into 5-minute intervals, on the Y-axis an ID is displayed, and the values represent a count of a variable when it takes on a particular value? If so, how should I structure the query for this?

what is your datasource?

AWS Timestream