Pivot reporting framework

the repeated code looks a bit strange. i think you could do `fields.view.map(compare).find(_!=0).headOption.getOrElse(0)`.... Although having just written that it doesn't look much nicer.