I need to invert negative numbers from the list that looks like this:
Items:
10
-20
-100
Note, that I need to keep empty values as empty. Here’s my solution, but it fails:
if ([Items]<0, 0 - [Items], [Items])
Error: Can’t recognize: if ([D20]<…
Source: action “Modify column(s)”, table “Derived”
dgudkov
2
Two mistakes here:
- The space between
if
and (
.
- Type checking is required if column values can be not numbers.
The correct expression is
if(isnumber([Column]), if([Column]<0, 0 - [Column], [Column]), [Column])
If the column always contains only numbers and empty values, it can be simplified:
when(isnumber([Column]), abs([Column]))