8 Replies Latest reply on Apr 17, 2018 6:35 PM by willard van de bogart

# Combining Bar Chart and Line chart in Tableau

Hi,

I am very new to Tableau. I have a question regarding combining Bar Chart and Line chart in Tableau.

I have 2 fields, [Sales Type] and 'Sales'. [Sales Type] field has 2 values: 'Sales Marging' and 'Sales'

I am Trying to show one chart in which I am showing bar chart for [Sales Type] and line chart for SM% (Calculation for SM% is : sales/sales Margin)

I have created 3 calculated fields:

1) Sales Type Margin:

IF([Sales Type] = 'Sales Margin')

THEN ([Sales])

ELSE (0)

END

2) Sales:

IF([Sales Type] = 'Sales')

THEN ([Sales])

ELSE (0)

END

3) SM%:

sum([Sales Type Margin])/sum([Sales Type Sale]) ( And converting in percentage format)

But I am not able to get correct value for SM%. Also I can see 'AGG(SM%)'

I would really appreciate if anyone can help me on this.

Thank you!

Regards,

Poonam

• ###### 1. Re: Combining Bar Chart and Line chart in Tableau

Hi poonam,

In calculated field SM%

try [sales Type Margin]/[Sales Type Sale]

it will not Show AGG. then

And for bar and line chart you can use dual axis.

thanks

Kawal

• ###### 2. Re: Combining Bar Chart and Line chart in Tableau

Hello Poonam,

I attached a sample workbook for your reference.

Two Options are included.

LOD is used in the calculation.

Please refer to Overview: Level of Detail Expressions for more details.

Regards

Lei

• ###### 3. Re: Combining Bar Chart and Line chart in Tableau

Hi Poonam,

Please attach the sample workbook here.

Thanks

Sankarmagesh Rajan

Mob:+919894170397

Aspire Systems (India) Pvt Ltd

Chennai

• ###### 4. Re: Combining Bar Chart and Line chart in Tableau

Hi Lie,

Thanks for the reply. Can you attached the workbook.

Regards,

Poonam

• ###### 5. Re: Combining Bar Chart and Line chart in Tableau

Thanks for the reply. But its not working

• ###### 6. Re: Combining Bar Chart and Line chart in Tableau

I tried the below LOD formula for SM% and it worked.

{ FIXED [PU]:sum([Sales Type Margin])}

/

{ FIXED [PU]:sum([Sales Type Sale])}

Thanks all for your help!

Regards,

Poonam

• ###### 7. Re: Combining Bar Chart and Line chart in Tableau

Hello Poonam,

Sorry that I forget the attachment

I've attached the workbook in my previous reply.

I didn't find the attachment in my first reply just now, so that I thought I'd forgotten to attach.

However, after I edited the reply, the attachment appeared... What a wired thing.

Anyway, thanks for marking my reply as correct answer!

Regards

Lei

• ###### 8. Re: Combining Bar Chart and Line chart in Tableau

would you consider introducing Tableau to my class at Shanghai Business

School

regards

Willard