Using lookup field in Formula field

Using lookup field in Formula field


I created the following formula field to get string output based on Lookup field values Lead and Account:
if(${Communications.Lead}!='','Lead',if(${Communications.Account}!='','Account','Other'))

The syntax seems correct, but I'm still getting an error. Can anyone help me with this?