how to use calculate table function