13 Replies Latest reply on Feb 23, 2018 12:23 AM by Jason Ing

    How to get subset and total counts and use them in a calculation field?

    Jason Ing



      Newbie here. I've been searching the forums for answers with no luck.


      My goal is to get subset and total counts and then calculate a percentage.


      A basic example: There is a "fruit basket" field of 4 apples, 2 oranges, and 3 bananas.


      I want just the apple count, total fruit count, and the percentage of apples: a) 4 apples; b) 9 fruits; and c) apples make up.44% of the fruit basket.


      I can get a sub count using filters or converting to a measure.


      But when I try to create a calculation field using my sub-count and total count fields, Tableau can't calculate it because it says it's a boolean and not a number. I've tried experimenting with sets, groups, parameters, filters, and conversions.


      So how do I get sub-count and total count fields that are numbers that can be used in a simple calculation field?


      I hope that made sense and I'm using the correct terminology.


      Thank you,