Calculate only when there is data