Unfortunately this doesn't solve my issue because i'm looking to see if a proportion of the population of residents at a given property exceeds the average proportion of that racial group overall; these proportions are percentages not raw numbers like sales dollars or number of people.
I think that's the issue here, my "Threshold" calculated field is giving a number but i really want it to be a percent, and so when i do a quick table calculation that converts the number of residents into a percent, it's not comparing apples to apples.
I attached for you the same work book but set up with a more similiar problem to the one i'm having. i have tableau 10 though so here's how you can set it up:
I dragged order priority to columns and category to rows; in my data set race would be the columns and property the rows. I dragged number of records to the marks card and changed it to percent of total (across)
The grand totals below are the threshold, so i wrote this calculated field:
case [Order Priority]
when "Critical" then 19.15
when "Not Specified" then 19.91
when "High" then 21.05
when "Medium" then 19.42
when "Low" then 20.48
I would want to color any instance where the percent of category has a proportion of order priority that exceeds the thresholds outlined above.
1 of 1 people found this helpful
You just have to make your own calcs to do the work.
On Sheet 5 (copy of Sheet 4) I made a calc: [Your calc in its own calc]. You have a quick table calc, but you can transfer it to your own calc by dragging it from your text shelf into a calc editor.
And I simulated Tableau's grand total math in my own calc as well. Tableau is taking the sum of all [Number of Records] by [Order Priority], and doing the same math that you see was transferred into [Your calc ...].
So I made a calc to gather the sum([Number of records]) (See [Number of records per order priority].) And I did the same math using that in [Threshold by Order priority].
Now I have my comparison field. You can see on Sheet 5 that my math comes up the same (number is positioned under the Order Priority label.)
Then, see [Colors for this example]. It's what I did on Sheet 3, just a little more involved because we have more complicated calcs in play. But the principle is the same.
Sheet 6 is your original Sheet 4, but with my new Colors calc on the colors shelf. (Note: The Colors calc is a measure. When you first put it on, Tableau gives you a diverging color scheme because it's a measure and tableau assumes a continuous variable. (See Sheet 7 for what that looks like.) But I right click on the pill on the color shelf and change it to DISCRETE, which is what you see in Sheet 6.)
I am not sure I understand you request correctly or not, but here is something.
if SUM([Number of Records]) / TOTAL(SUM([Number of Records]))> attr([Thresholds (Percents)]/100) then 1 else 0 end
Change this field to "Discrete" and put as color.
Sorry to jump in Joe.....
I should have stopped.
This was the perfect fix! I knew LOD was going to play into this some how, I really appreciate you walking me through each step!