Water activity (aw) is calculated using the formula \( a_w = P/P_0 \), where P is the vapor pressure of food and \( P_0 \) is the vapor pressure of pure water. This measurement indicates the availability of water for microbial growth, which is crucial in food preservation.