My gender ratio here is 1:2, hence I want to know how could I make a graph like below:
Please help me out! Thank you guys!!!!
When choose Male:
When choose Female:
Okay, I'll assume your data looks something like this:
Person IDGender1Male2Male3FemaleConnect to the data in Tableau. Make sure Person ID is a dimension, then drag it to the detail card. Next create a parameter, which I'll call Select Gender with two options: Male & Female. Then create a calculated field:
Color
// Specify the color based on selected gender.
IF [Gender]=[Select Gender] THEN
"Blue"
ELSE
"Black"
END
Drag Color to the color card and make sure the pill is above the Person ID pill. Then set the Color pill to sort alphabetically descending. This will make sure that blue is always the first color. Finally, specify your colors for each of the two options.
See attached.