Add new "changed" function

This function checks if a metric has changed and returns 1 when it changed else 0.
This PR replaces #510