Question regarding the IF-THEN-ELSE statement


Is it possible to execute an if-else statement regardless of whether the column 'Summary0' contains '1B' in the table? If 'Summary0' does contain '1B', the statement should then calculate the sum of [1A] and [1B].

IF not contains([Summary0], '1B')

I attempted to use this expression above, but it doesn't seem to function correctly.

Hi @tanweike and welcome to the Community!

Currently, all columns mentioned in an expression must be present in the dataset. In your case, you can create column [1B] with a dummy value if it didn't exist (see below), before the IF/THEN expression.


There is a more complex workaround. You can use the function columnexists() as described in my answer in another thread here: Optional calculations with columns - #2 by dgudkov

1 Like

Hi @dgudkov thank you for your prompt response. I appreciate it.
I tried the approach you shared, and it works perfectly! Thanks you so much!

You're welcome :slight_smile:

1 Like