2 Replies Latest reply on Oct 10, 2018 11:53 PM by Manuel Kavekos

# Pie Chart from Caclulated Field

I am using 10.5 and trying to create a pie chart from a calculated field but it is not sorting by color properly. I've created 2 fields so I can group each member into one of four groups. For example if a member is Medical then the Last Record should be Medical. If the member is in two groups however, the Last Record should show Medical + Pharmacy. The problem is when I try to create a pie chart, it is not sorting the groups properly. I am trying to sort by group based on the Last Record column:

Medical + Pharmacy is in different places rather than sorted by color.

Manny

• ###### 1. Re: Pie Chart from Caclulated Field

Hello Manuel,

I think I found a solution however I am not sure if it would work with new data or if it could be scalable. First I made a duplicate of your data source within Tableau and joint both tables using the Member ID field on each of them:

From the second table I just kept the Domain field identified in the workbook as Domain(Sheet11). Then I made a reference table to create my calculations (Sheet 9):

As you see by doing a cross-join we get all the combinations of categories within the Domain field by each Member ID but we just need one row per Member ID, if the Member ID has just one Domain category we use it as-is but if there's more than one Domain category per Member ID we need to filter the duplicate combinations or the single combinations (look at the table for more clarity). So, to do this, I assigned a value to each Domain-Domain (Sheet11) category combination, by doing so we can filter the row that we need.

Basically we need the rows where the *Combined Domain Filter field is equal to 2 and *Combined Domain Filter is (equal to 1 AND Domain is different to Domain (Sheet11). To do this first we need a calculation that gets the maximum value for each Member ID and repeats it on every row of each Member ID, we do this with a FIXED LOD calculation, field *New Domain:

In the picture below I have arranged my calculated fields as 1,2,3; those number are the sequence as I created them. Hopefully you will understand my explanation . If not you can ask me. The final result is as below:

Let me know if this solves the problem, thanks!\

Cheers