At the moment I have a view created, [see it here in the answer][1]. How can I create a function on that cross tab, so I can pass a date, and get data for the specific date? Also is it a good practice to call that function multiple times to fill for example a chart? [1]: http://dba.stackexchange.com/questions/71236/pull-data-from-multiple-tables-in-a-view-or-function