You can convert the category field to a dimension and then just do your calculation on the number of records. Putting category and year as discrete dimensions should do this, then you can bring out number of records and just do a Quick Table Calculation (Percent of Total).
I attached my approach - hope this helps!
Group by Type.twbx 6.6 KB
You can also try making a calc like this?
sum(if [Category]=1 then 1)
sum(if [Category]=2 then 1)
This way, you can drag year to rows, then double click those measures (this will show both in text).
Hope this helps,
Andrea, I tried to download it but it wouldn't allow me to open the workbook since it was not a Tableau Public file?
But you're saying convert Category and year to discrete dimensions, do a table calc to get total number of records for category 1 and 2?
Lisa, I just tried your approach and was able to get the data in a line chart with year and totals for the categories...but it won't allow me to use a pie chart? It's greyed out...It looks to me like I should have the correct number of measures and dimensions.
I think i misunderstood what you were looking for. Are you looking for something like this:
Is Category a dimension for you? Can you make it a dimension without affecting your other charts/views? If no, I would suggest building the pie chart like so. To get percent of total, make a quick table calculation (percent of total) and compute it using Region.
Otherwise, please share an image of what you're referring to.
Hope this helps.
Yeah that is more what I am looking for! I will try that and see if I can make something similar work!
Ok so I converted Category to a dimension but am struggling with the table calc...I currently have this.
COUNT([category])/sum(if [Category]=1 or [Category]=2 then 1 end)
Which currently gives me a even 50% pie chart, which is because I think I am only counting two categories...how can I get total number of occurrences in the numerator for categories 1 and 2?
All told there are five categories, but the only two which are significant are 1,2 right now. Here is a screenshot of the pie graphs I'm talking about!