That simple expression should work, but only in the case that the accelerometer has the Z axis perfectly vertical, when the instrument is perfectly vertical, which requires careful alignment during construction.
The simplest approach to the general case, which does not require any special alignment of the accelerometer (but does require two readings), is given in Section 4 of this guide.