8 Replies Latest reply on Oct 23, 2018 9:10 AM by Michele Boulais

# Continuous Line - Formula Issue

Hello!

This is my first forum post, so thank you for your help, Tableau community! I am trying to make a continuous line chart that is broken up by demographic subgroups for a component of a student survey we conduct each year. The measure we use is "percent positive", ie we want to know what percent of students in a specific group answered a group of questions positively.

I have figured out how to get a line graph going that will count how many "positive" records there are in total for each group, but i'm not sure how to get it to calculate that as a percent of the group total. I would also want to be able to do a gender/class breakdown the same way. ("What percent of girls answered positively? What percent of juniors vs. seniors?")

I am working off Tableau Public, so here is the link to my workbook:

Right now there is just one academic SEL indicator with data in it (called "Academic Behaviors") but in the final version of this i would like to calculate this number and graph it for the other survey categories as well ("Sense of Belonging", "Growth Mindset", etc.)

Thanks again,

Michele

• ###### 1. Re: Continuous Line - Formula Issue

Hi Michele,

You could do some case/if statement calculations. E.g. to count how many academic behaviors for female, you can do:

Female Count

if [What is your gender?] = 'Female'

END

To find the % of total:

Female %

Then bring this female % into the view and format it as a percentage:

Please see the attached workbook, worksheet Sheet 2(2) with my example.

Thanks,

Mavis

1 of 1 people found this helpful
• ###### 2. Re: Continuous Line - Formula Issue

Hi Mavis, this is exactly what I needed! You are the best.

1 of 1 people found this helpful
• ###### 3. Re: Continuous Line - Formula Issue

Hi Michele,

Thanks,

Mavis

• ###### 4. Re: Continuous Line - Formula Issue

Hey Mavis!

I marked that as correct! I do have one follow-up though. Your first answer helped me start thinking about formulas and how they work in tableau, but it didn't get me to the final place i needed, and i'm still having some trouble.

Here is my current chart:

It shows a count of how many students in each demographic answered positively about self-advocacy factors. However, what i need to know is what percent of students in each demographic answered positively. So i need to do a formula that is like ( girls answering positively / total girl responses) but i'm missing something about how to make that work!

Thanks,

Michele

• ###### 5. Re: Continuous Line - Formula Issue

(Sorry, unmarked as correct for now bc i realized i might not get a response to my follow-up question that way. will mark as correct for both after!)

• ###### 6. Re: Continuous Line - Formula Issue

I'm so close! I got it to work in table form, but just need to get the graph into the same shape as your screenshot above. I currently have a very wonky version instead... (see "Line graph" tab)

• ###### 7. Re: Continuous Line - Formula Issue

Hi Michele,

As you've used table calculations, I suggest using index as the table calculation to only show the positive results, please follow the steps:

Convert to Discrete:

Then edit the index() table calculation

Set it to specific dimensions Negative/Positive:

Then bring the index() field to be a filter and set it to 2:

Then bring your negative/positive field to be detail instead of colour in the marks card. Then bring your 'what is your rac...' field in as colour on the marks card:

Thanks,

Mavis

1 of 1 people found this helpful
• ###### 8. Re: Continuous Line - Formula Issue

Mavis, you are an inspiration!

That was really clear and easy to follow, thank you! I've marked as correct - this was exactly what I needed. Now i will just go google more about indexes to figure out why exactly it worked...