Create measure function