I need to transform, transpose, whatever the right terminology is a data set with multiple rows and instead return a single row with multiple columns. Here is a sample of the data that I start with
EID PM Project HOURS WeekStarting
joe@test.com tom@test.com Proj A 6 11/28/2016
joe@test.com tom@test.com Proj A 3 12/5/2016
joe@test.com tom@test.com Proj A 7 12/12/2016
joe@test.com tom@test.com Proj A 3 12/19/2016
sue@test.com sam@test.com Proj B 3 11/28/2016
sue@test.com sam@test.com Proj B 6 12/12/2016
sue@test.com sam@test.com Proj B 7 12/19/2016
I would like to format the data like so
EID PM Project Week1 Week2 Week3 Week4
joe@test.com tom@test.com Proj A 6 3 7 3
sue@test.com sam@test.com Proj B 3 0 6 7
Note that for sue there is no data in week2 in my source data so the result is 0 for week 2.
Currently I am doing this in Javascript using the reduce function but it's very messy. I would rather try to fix the data and have clean Javascript.
Any help is much appreciated.