How to divide values from the same dimension in Tableau?

Viewed 611

I am trying to divide values from the same pill in Tableau. Per my screenshot, the pill is named "Animals" & the grouped values within that pill are dog, cat, hamster & horse.

How can I divide dog by cat? How can I divide hamster by horse? How I divide cat by hamster? etc.

How would I create a calculation to show the desired values?

enter image description here

1 Answers

Without the option of pivoting rows to columns available in Tableau Desktop, you have to manually create each of the desired ratio calculated field.

I have created a sample data by sampling 200 rows in a Programming language

Your created view is like this

enter image description here

Now create a calculated field for each of the desired ratio. say cat/dog like this

ZN(SUM(IF [Animals] = "cat" then 1 else 0 END))/ 
ZN(SUM(IF [Animals] = "dog" then 1 else 0 END))

Better use this field as discreet

Add this field to view you'll get desired ratios

enter image description here

Related