divide grand total by category

0 votes
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, 2019 in Tableau by anonymous
944 views

1 answer to this question.

0 votes
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, 2019 by Cherukuri
• 33,030 points

Related Questions In Tableau

0 votes
1 answer

How to divide one measure by another?

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

answered Apr 10, 2018 in Tableau by ffdfd
• 5,550 points
1,055 views
0 votes
1 answer

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

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

answered Apr 12, 2018 in Tableau by QueenBee
• 1,820 points
707 views
0 votes
1 answer
0 votes
1 answer

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

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

answered Aug 10, 2018 in Tableau by AwesomeSauce
• 860 points
3,469 views
0 votes
1 answer

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

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

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
9,391 views
+2 votes
1 answer
0 votes
1 answer

Calculated filed with if-then

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

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
1,277 views
+2 votes
1 answer
0 votes
2 answers

How can I display filtered value and grand total in the same sheet?

You can create a fixed calculated field ...READ MORE

answered Sep 15, 2018 in Tableau by Machdata
• 340 points
706 views
0 votes
1 answer

How to add custom labels to bar chart and grand total charts?

Hi, Once you created the bar chart ...READ MORE

answered Mar 4, 2019 in Tableau by Cherukuri
• 33,030 points
2,765 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP