level calculation algorithm for scorecard