indraneel | #1195 | fixing bug- pivot table now gets obs values from latest encounter