Expand my Community achievements bar.

Can calculated fields take dropdown field values?

Avatar

Level 1
Is it possible to access custom dropdown field values in a calculated field? Currently I am trying to create a calculated field that returns a value based on the value of a dropdown field, but every time I attempt to add the dropdown field to any expression, the system says it is an invalid expression. I have used calculated fields w/ data from string & number fields, but I'm not sure how dropdown fields are understood in the system. Austen Harrison
5 Replies

Avatar

Level 6
Austen, A few things to consider: - Your expression may be invalid to a syntax error, or because you don't have the dropdown field in the same custom form as your calculated field. Even if your dropdown field exists in other forms that will be attached to your objects (project, tasks, issues, etc.), the system validates against expressions only when they are in the same custom form as the calculated field. - Make sure that you are basing your calculation off of the VALUE that is in your dropdown field and not the label. If you have not set a new value for each dropdown option, then you should be fine. Will Schmidt Workfront

Avatar

Level 2
Piggy-backing off Will's reply - your dropdown should be single values only - allowing multi-select makes referencing it in calculations a MAJOR challenge. I've done it to streamline values for reporting needs. Heather Theriault MetLife

Avatar

Level 1
Hey @Will Schmidt , your first point was actually close to what my problem was. Turns out it was an issue with the naming of the field. I had included a special character in the label of the field, which apparently causes the calculation to error out. I suspected this might be the case, I thought perhaps dropdown fields work differently, but apparently they do not. Here's what I was attempting to do: Problem: Cannot calculate based on a custom dropdown field called "What is the impact?" . My calculation was something like: IF(CONTAINS('Critical',What is the impact?),true,false) - but where true and false where other valid expressions for determining the value of the calculated field. Solution: Removing the question mark resolved the problem. A field with a label w/o a special character can be used in the calculation. Conclusion: Assuming now that this is unrelated to dropdown fields specifically, more likely a bug. Dropdown fields should be able to work in calculations just like any other field (assuming everything mentioned on this thread about values, etc.). I've also got a case w/ Workfront support and will ask if there is any special character escaping. Thanks everyone! Austen Harrison Tableau Software

Avatar

Level 10
I don't know if I've actually done it with a dropdown field, but I would imagine it would be treated like any other field. It's just a value, regardless of how the value got there. Keep in mind I'm saying this using the logic in my head and my development background. In no way should you consider this fact, or what's actually happening in reality �� . If you cut & paste the code, perhaps some of us can look at it and see if there's any kind of syntax issue? Vic Alejandro, PMP, CSM | IT | Sr. Technical Project Manager Denver Water | t: (303-628-7262) | c: (303-319-6473) "http://www.denverwater.org/"> http://www.denverwater.org INTEGRITY | VISION | PASSION | EXCELLENCE | RESPECT

Avatar

Level 3
In the calculation, you have to put curly brackets around custom fields that have special characters. I have numerous fields with dashes or question marks in them and all my calcs work. Ondina Sturges Everyday Health Inc