I run into this problem all of the time and use the solution give by Jerry. I analyze process measurements (temperature, pressure, flow, etc.) that are retrieved from a compressed-data-historian. Every few thousand points, there can be a missing value.
Example below calculates if reactor is running or not based on 3 point moving average of catalyst flow, F.Cat >= 11 (anonymized yes, you get the reference...). If F.Cat is missing, calc uses previous row's value of "Running?".
If(
Row() < 3, 0,
Is Missing( :F.Cat ), Lag( :Name( "Running?" ), 1 ),
(Lag( :F.Cat, 2 ) + Lag( :F.Cat, 1 ) + :F.Cat) / 3 >= 11, 1,
0
)