MPU6050 Gyro value going back to initial value irrespective of Angle

MorganS:
It depends on the declaration of offsetVal.

offsetVal will be declared as global variable i.e

float offsetVal;
void setup(){
...
}

or is it something else ?
Can you please explain bit more about it ?