Koon, I played around with one of my workbooks and I'm getting similar results, but mine are completely consistent.
Specifically 'Total Population' is stored in a parameter, I get these results:
CASE [Select Demographic:]
WHEN 'Total Population' THEN [Total population Number] // Works
WHEN 'total population' THEN [Total population Number] // Does not work
WHEN UPPER('totaL PopulatioN') THEN [Total population Number] // Works
As I said, these are consistent results. You might have gotten inconsistent results because you made the same typo you made in your post: IFF instead of IIF. (I've done that one many times myself.)
Hope this helps --Shawn
Depending on your data source, string comparison is or is not case sensitive. Sometimes depending on the exact situation, this can effect creating an extract and if you create the formula before or after the extract, and if you refresh the extract it may evaluate differently. Tableau tries to be consistent, but I have experienced some inconsistencies in past.
Thanks Shawn and Joe. I think I figured I better convert everything to either upper/lower to decrease the chance of inconsistency.