Skip to main content

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:

Chart

 

When choose Female:

pastedImage_2.png

5 answers
  1. Oct 28, 2018, 11:44 PM

    Okay, I'll assume your data looks something like this:

      

    Person IDGender1Male2Male3Female

     

    Connect 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.

     

    Okay, I'll assume your data looks something like this: Person IDGender1Male2Male3Female Connect to the data in Tableau. Make sure Person ID is a dimension, then drag it to the detail card.

     

    See attached.

0/9000