4 Replies Latest reply on Feb 5, 2016 5:08 PM by Sajid R

# Merging two columns to make a Pie Chart

I have the following data

 Col B Col C Col D Col E 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 1 1 0 1 0 0 1 1 1 0 0 1 1 0 0

I want to create a pie chart by using following conditions

IF(B =1 OR C=1)

THEN

BC+

IF(D=1 OR E=1)

DE+

 Col BC Col DE 6 4

How can achieve this calculation ?

• ###### 1. Re: Merging two columns to make a Pie Chart

Hi Sajid,

This is an interesting problem!  I am not sure if this is entirely possible in Tableau, but before I verify that, I want to make an argument against Pie Charts.

Pie charts are not very useful for insight.  The ability to compare values in a Pie Chart is much less than the insights possible in something like a Bar Graph.  To create a bar graph, given your data, you would create two calculated fields:

Calculated Field Name:  Col BC

IF [B] = 1 AND [C] = 1 THEN 1 END

Calculated Field Name:  Col DE

IF [D] = 1 OR [E] = 1 THEN 1 END

You then bring both calculations to Columns, and bring Measure Names to Rows.  Change the Mark Type to Bar (If needed), and there you have it!

I have attached a solution.

I hope this helps.

Cheers,

Eli Blankers

2 of 2 people found this helpful
• ###### 2. Re: Merging two columns to make a Pie Chart

Hi Eli,

The calculation got accepted but I am still getting Null values. Must be something related to my data source.

Thanks a lot !

Best,

Sajid

• ###### 3. Re: Merging two columns to make a Pie Chart

Hi Sajid,

If you'd like, attach a twbx with your example and I can try to walk through a solution.

Cheers,

Eli

• ###### 4. Re: Merging two columns to make a Pie Chart

Hi Eli,

Thank you so much for you reply ! I checked out the .twbx file and it helped me out.

Best,

Sajid