1 2 Previous Next 21 Replies Latest reply on Aug 2, 2018 12:27 PM by mathew k

# How to display the percent difference between 2 columns in a third column?

Hello!

I am trying to display the percent difference between two columns (2016 and 2017) in a third column, while still keeping the number of records in the 2016 and 2017 columns (just adding a 3rd column for the percent difference). If anyone has any ideas that would help me, I would really really really appreciate it!

• ###### 1. Re: How to display the percent difference between 2 columns in a third column?

See attached and screenshot.

Thanks

Deepak

• ###### 2. Re: How to display the percent difference between 2 columns in a third column?

Hi Jessie

there is a table calculation that does that - Percent Difference

it will return this

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

1 of 1 people found this helpful
• ###### 3. Re: How to display the percent difference between 2 columns in a third column?

Thank you!

How do you get the SUM (2015) and SUM (2016)?

• ###### 4. Re: How to display the percent difference between 2 columns in a third column?

Jessie

the sum is created by dragging sales to the viz and it will aggregate there - the default is Sum()

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

• ###### 5. Re: How to display the percent difference between 2 columns in a third column?

Slowly but surely getting there. Thank you so much for your help!!

How were are your original values for 2016 and 2017 columns still visible?

• ###### 6. Re: How to display the percent difference between 2 columns in a third column?

Thanks

If you haven't tried the on-line video training they real are good - I would suggest Calculations

see the link Tableau Training and Tutorials

Jim

• ###### 7. Re: How to display the percent difference between 2 columns in a third column?

I will definitely take a look a the videos!

How were are your original values for 2016 and 2017 columns still visible?

• ###### 8. Re: How to display the percent difference between 2 columns in a third column?

Just leave both Sum Sales and the table calc for the % difference in the view - you need to put in Sales convert it to a table calc and then add Sum sales back in a second time

Jim

1 of 1 people found this helpful
• ###### 9. Re: How to display the percent difference between 2 columns in a third column?

THANK YOU!!!

• ###### 10. Re: How to display the percent difference between 2 columns in a third column?

Now that I figured it out, I'm getting picky. Is there a way to color code the percent difference column? Ideally where everything under 32% is green and everything over 32% is red?

• ###### 11. Re: How to display the percent difference between 2 columns in a third column?

OK now you are going for the advance course

first add a calculation shown below - it is nothing but the % difference table calculation from before

The easy way to get the formula is to just drag the green pill off the measure value card - it will change the name to calculation 1

then go to the measures frame and find calculation 1 and re-name it as shown - I just needed a calculated field for step 2

then create another calculation

This is nothing but a field to separate based on the percentage you want and group the values into 2 bucket called red and green

The bucket names do NOT create the color

For that

Put you color indicator on the color tile

Then click on the tile and edit color - it will open the second box and the little colored squares will not be the correct color

click on the square and then select the color from the pallet you want

When done click ok (also Note best practice is to NOT use red/green - too many color blind people - Blue / Gold  - Red /Black are better

Jim

• ###### 12. Re: How to display the percent difference between 2 columns in a third column?

Percent difference needs to be aimed a direction. Here you're using table across.

Okay you can see below, I have the same problem as you are having! Have no fear, literally everyone has this same problem. You need to include 2012 data to ensure this 2013 field is NOT blank. But technically speaking, below is showing you the correct difference between 2013 and 2012... Zero - which is NULL, and not showing a value.

Have no fear, they have a 'HIDE' based on your right click. So right click, and say bye bye 2013!

If you're filtering 2012, then don't do that anymore. Hide it because the logic will play out against you

If you don't have 2012 data, let me know - there's an easy sql solution to 'pad your data.' And it's very easy. Let us know.

best,

tyler

dev3lop

• ###### 13. Re: How to display the percent difference between 2 columns in a third column?

Genius!!

Now is there anyway for the "Number of Records" columns to stay black? And just the "Percent Difference" change color?

• ###### 14. Re: How to display the percent difference between 2 columns in a third column?

totes!

right click what you want to format, columns should b the b ticket, holding baby now - srry for short reply

Pane! not header for inside the view

1 2 Previous Next