1 Reply Latest reply on Apr 30, 2018 8:36 AM by Marc-Anthony Di Biase

# For a given date, I have 2 sales types - A & B. How do I divide Sales type A / Sales type B if Sales is my dimension?

Hi Tableau community,

My dimension is Sales Type and there are two options - A & B. The one measure is then sales #s. This is monthly sales data.

For any given month, I would like to write a calc that shows Sales type A / Sales type B.

Also as a side note, when I pull in the date field and click on "Date" as the type of value, when I do "Month" as in "May 2016" it converts the pill from blue to green and shows "+ MONTH(Date)" and therefore messes up my "sales #s" measures when I put it on text. I simply want a chart with the sales #s as text. Now it's showing blue lines for each month.

Thanks,
Ava

• ###### 1. Re: For a given date, I have 2 sales types - A & B. How do I divide Sales type A / Sales type B if Sales is my dimension?

Hi Ava,

Try making a calculated field based on the Sales Type dimension, then aggregating the sales #s based on the type. It would like something like this

sum(IF ([Sales Type] = 'A') THEN [Sales #] END) / sum(IF ([Sales Type] = 'B') THEN [Sales #] END)

This is assuming your sales # is a continuous value like sales amount