Filter stat for last time value was x

Hi all,
I am trying to figure out a single stat to show the last time the value of a item was “1”.

SELECT last("value") FROM "BasementWaterSensor_AlarmFlood" WHERE ("value" = '1') AND $timeFilter GROUP BY time($__interval) fill(null)

But I am getting no luck, is there something else I should be doing?

Thanks

Just as a follow-up, I fixed this by removing the last part of the query, so the query now reads:

SELECT last("value") FROM "BasementWaterSensor_AlarmFlood" WHERE "value" = '1'