I am working for a tall, normalized table where all my elements are in one column, and the value in another. I want to select the sum value from one element (tonnes of agricultural production) and divide it by the sum value of a second element (hectares of harvested area) to calculate the rate of yield (tonnes per hectare)
The details:
Create = # Area Harvested:
IF [element_txt] = "Area Harvested" THEN[val] ELSE NULL END
Create = # Production Quantity:
IF [element_txt] = "Production Quantity" THEN [val] ELSE NULL
Both these calculations work. However, if I want to create the = # Yield calculation by dividing one by the other, it comes out NULL. Here is what I am using for the third calculated field:
[Production Quantity]/[Area Harvested]
Any ideas?
I think I got it! I was missing SUM.
This is what works:
SUM([Production Quantity])/SUM([Area Harvested])
Become a Viz Whiz on the Forums!
Support the Community and master Tableau.