lundi 22 juin 2015

using if statements in tableau on a contains function

Say I have city populations for each state / city in the united states. I want to mark each city with over 2 million population as a big city. then if a state contains a "big city", i want to mark that state as a "big state". I made a calculated field:

if Pop>2000000 then "big city" else "small city" end
This works fine.

Now when I try to make a calculated field for state I tried this:

if contains([big city],"big") then "big state" else "small state" end

This almost works, but I get multiple values for each state when I only want 1 value, either big state or small state. How do I stop tableau from creating multiple values?

Aucun commentaire:

Enregistrer un commentaire