How do I calculate metrics in visualizations?