4 Replies Latest reply on Apr 15, 2016 5:43 AM by Renato Rocha

# How to calculate difference in 2 bar charts ?

Tks all for your help,

I would like to know how to calculated a difference between a market share comparison showed in a line chart ?

My expected answer for each week is 28pp (percentage points) in first week, 18pp, 14pp, 34pp, 52pp, 0 pp. • ###### 1. Re: How to calculate difference in 2 bar charts ?

Você vai ter que calcular por fora em um campo calculado, mas não dá

para responder sem saber como calcular a parte azul e a laranja.

Qual a conta da medida e o que está na cor?

Em 14/04/2016 21:58, Renato Rocha escreveu:

TABLEAU SUPPORT COMMUNITY

HOW TO CALCULATE DIFFERENCE IN 2 LINE CHARTS ?

criado por Renato Rocha  em Forums - Visualize a discussão completa

1 of 1 people found this helpful
• ###### 2. Re: How to calculate difference in 2 bar charts ?

Hi Renato,

Please can you share the workbook if possible?

Regards,

Rohan Malusare.

• ###### 3. Re: How to calculate difference in 2 bar charts ?

Hi Renato,

you can use the LOOKUP function for this.

If you use SUM([YourValueField)-LOOKUP(SUM([YourValueField]),1) and then make sure that the table calculation is sent across the dimension that is splitting your bar chart in two you'll get the difference between the two values.

If the underlying data is already a percentage that will be enough, otherwise you'll need to divide it by the total sum of the two bars which you'll get from the WINDOW_SUM(SUM(YourValueField))

so the final calculation will be

(SUM(Sales)-LOOKUP(SUM(Sales),1))/WINDOW_SUM(SUM(Sales))

(This will produce half the rows as null because only one of the bar chart segments can lookup 1 field further forward, but that's OK because you want fewer points in the line chart than the bar) Hope this helps

Dave

InterWorks

2 of 2 people found this helpful
• ###### 4. Re: How to calculate difference in 2 bar charts ?

Hi, Dave.

Excellent. This works perfectly fine.

Many thanks,

Renato Rocha