'Tableau calculated field gets a NULL value

In Tableau, I've created a calculated field, as follows.

if [TOTAL] <> 1 then '0' elseif attr([Field_1]) = 'ABC' then '1' else '0' end

However this calculated fields returns NULL value, which doesnt make sense because the definition I gave above doesn't assign NULL value to it.

[TOTAL] and [Field_1] don't contain NULL value either.

Could someone please advise? Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source