Some times you will have to cast your values into Double using the todouble() format for the division inside the pivot to work as expected.