You may find more detailed description, code and downloadable working example here:

 

https://github.com/Inflectra/rapise-samples/tree/master/CustomColumnReporting

 

The approach used here is similar to one used in KB433 and in KB537.