If statements for Calculations

I am trying to create a state that says “If a column is blank, type na” If the column is not blank, or is a number greater than 0, then perform the following divide calculation. I have put the code below. I am getting the error listed below it:

Test =
IF(
Calcs[Conv Weight] = BLANK(),
“na”,
IF(
VALUE(Calcs[ConventionalCycleTime]) >= 0,
DIVIDE(Calcs[Conv Weight]-Calcs[iMFLUXPartWeight],Calcs[Conv Weight])))

Error: Expressions that yield variant data-type cannot be used to define calculated columns

Please help!

@stiefel.ed Do your calculated columns have the same Data Type? It usually occurs when you have both number value & text value in one calculated column.

It would be helpful if you can attach your pbix and excel file.

Thanks.

Yup, you’re trying to put 2 different data types in the same column, so the error. You’ll need to change one of them, either the na to 0, or format the number as a string.
Greg

1 Like

Is there anyway to make that happen? I want an NA to come up in my report if there is a blank, but otherwise use a calculation of 2 other columns.

(Column A- Column B)/Column A

You could do the calculation as you want, then convert the result to a string, but that means you’ll need to do that for any totals as well, as auto-totalling won’t work.
Greg

Thank you, I think this is helpful. I will respond if I have any further issues.

Hi @stiefel.ed, a response on this post has been tagged as “Solution”. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box. Also, we’ve recently launched the Enterprise DNA Forum User Experience Survey, please feel free to answer it and give your insights on how we can further improve the Support forum. Thanks!