Hi, how can I get the calculation for below conditions,

1) Type A,B,C = each/ total for a,b,c

2) Type D =  D / Grand Total

How to do this? Jun 6 in Tableau 32 views

1 answer to this question.

Use the calculated column to calculate the sum of sales for a, b, c like below

Sales_a_b_c = IF [Type] = "A" OR [Type] = "B" OR [Type] = "C" THEN [Sales] ELSE 0 END

Now To calculate calculation for each type

IF [Type] = "A"  THEN SUM([Sales]) / SUM([Sales_a_b_c])

ELSEIF [Type] = "B" THEN SUM([Sales]) / SUM([Sales_a_b_c])

ELSEIF [Type] = "C" THEN SUM([Sales]) / SUM([Sales_a_b_c])

ELSE [Sales] / { SUM([Sales]) }

END

Try the above, hope it helps! answered Jun 10 by
• 28,040 points

How to divide one measure by another?

Yes it is possible, Option 1: Create a calculated ...READ MORE

Divide count of Table 1 by count of Table 2 on the same time interval

Use a custom SQL to create a ...READ MORE

Is it possible to split the color by some category within a Waterfall chart?

It's a very easy task to do. ...READ MORE

Want to hide the Bar for Grand Total in the bar chart in Tableau

Tableau treats the whole visualization uniformly.  If you ...READ MORE

How to color code cells of a column based on the text value in Tableau

You can use the following steps to ...READ MORE

+1 vote

How to Link Dashboard with URL to enable it to open in the same explorer page

Add this to the end of the ...READ MORE

Calculated filed with if-then

Below is the required code:  IF (NOT ISNULL([test2])) ...READ MORE

How can I download tableau workbook with its data from tableau server?

In essence, no. Since the workbook is ...READ MORE