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

    Pie Chart from Caclulated Field

    Manuel Kavekos

      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.

      Thanks in advance!



        • 1. Re: Pie Chart from Caclulated Field
          Adolfo Hernandez

          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!\




          • 2. Re: Pie Chart from Caclulated Field
            Manuel Kavekos

            Thank you Adolfo for the quick and creative response. I've been working through this and can see this working as an option for this data set but the issue will still be working with new data. The data I am working with will be updated at least monthly and think I need a solution that doesn't require as many calculated field combinations nor a self join. I did get some ideas as you've provided a creative solution but still want to continue with a different approach if you or anyone else has other ideas.