Add new "changed" function

This function checks if a metric has changed and returns 1 when it changed else 0.
This PR is a new version of #150, targetting the correct branch