Table with new row if value cange

Hello together

I try to setup a table for some avaibility statistics.

For that I have several prometheus metrics like:
up{instance=“123.123.123.123”}

The Value can be “1” for UP and “0” for DOWN.

If I insert this metric in a table than I get for every 15 seconds a new row.
But I only like to get a new row (including timestamp) if the value change
from “0” to “1” and from “1” to “0”.

How can I setup this in Grafana.

Thanks in advance
Manfred