From the course: Tableau: Mastering Calculations

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Pitfall: Calculating weighted ratios

Pitfall: Calculating weighted ratios - Tableau Tutorial

From the course: Tableau: Mastering Calculations

Pitfall: Calculating weighted ratios

We want to calculate our profit margin, meaning what proportion of our sales were returned as profit. We just calculated the profit in the previous video. Let's start with this visualization that shows profit and sales per SKU and category. But we don't want to have to do the mental math. We would rather pre-calculate and display the values. To do this, we calculate the ratio of profit to sales. In a new calculated field, profit margin in percent, and the calculation here is profit divided by the total price. The calculation is valid, so we can confirm and close with "OK". Let's move this new field to the columns and we can see in the labels that can't be quite right. Well, actually, we wanted to see percentage values. Please do not touch the calculation. We already calculate a decimal value. We just need to change it to a percentage using formatting. So we go to the data pane, right-click, and go to Default Properties to change the number format. Let's set this to a percentage and…

Contents