My viz shows the total number of students cohort and how many took math during their first year. This is a dual-axis line graph showing six years, so the line for the total number of students appears above the line for those who took math. I want the lower line, which counts the students who took math, to show the percentage of the total in a label. So far, so good. The problem is that in my real viz, the percentage seems inaccurate. Because the number of students who took math in the first year is 593 and the total number of students 2,906, I would expect the percentage to be 593/2,906 = 20.4%. But my real viz shows 18.7%. And in the attached viz, which includes a lot less data but the same fields and calculations for this view, I get 100%. Apparently, it's just comparing the count of students who took math to itself. How can I get the correct percentage?
In case it helps anyone, here's how I solved this: 1. Made a calculated field called "Math Yes Count" with the following formula: SUM([Students Completing Math]). 2. Made a calculated field called "% Took Math" with the following formula: [Math Yes Count]/[Students] 3. Dragged % Took Math to the Label on the Marks card. It now shows the expected percentage, 20.4%.
Become a Viz Whiz on the Forums!
Support the Community and master Tableau.