4 Replies Latest reply on Dec 28, 2016 11:07 AM by Shawn Wallwork

# Replacing an integer to display N/A for a certain category

Hi all,

Is it possible to display N/A instead of the integer for a specific category?

For example, in my data we have different types (A, B, C so on)

I have the average dollar and totals for each category but for category A I'd like it to say N/A instead of the integer it's producing since it's not relevant for it.

Reason being, I still want it to show to the total but for average to display N/A.

Any work around?

When I try a table calculation

IF [Category] = "A" THEN [Dollar] = "N/A"

ELSE [Dollar]

END

It gives me this error, Can't compare float and string values.

If I remove " " around N/A ==> THEN [Dollar] = N/A

It gives me this error, expected type boolean, found float. Result types from 'IF' expressions must match.

Thanks!

• ###### 1. Re: Replacing an integer to display N/A for a certain category

That's not the way an IF statement works. You can't use an equation after the THEN. So try this:

IF [Category] = "A" THEN "N/A"

ELSE [Dollar]

END

Or possibly this:

IF [Category] = "A" THEN "N/A"

ELSE STR([Dollar])

END

Or possibly this:

IF [Category] = "A" THEN NULL

ELSE [Dollar]

END

This last one will produce blanks or nulls for the A category.

--Shawn

• ###### 2. Re: Replacing an integer to display N/A for a certain category

For the any of these wouldn't you have to say [Dollar] is NULL or [Dollar] is N/A otherwise it doesn't know where to input NULL or N/A for Category A since it's not defined.

Does that make sense?

• ###### 3. Re: Replacing an integer to display N/A for a certain category

Hi Shelby,

This calculation will not refer to [Dollar] if the [Category] is A. Hence when [Category] is A, it automatically displays the static string "N/A" and when [Category]  is not A, it looks at the value in the [Dollar] Field.

The downside is that this will have to be a String type, hence you won't be able to do any Aggregations/totals using this exact field. For this, you could use ZN function which will replace all NULLs with 0.

1 of 1 people found this helpful
• ###### 4. Re: Replacing an integer to display N/A for a certain category

What Sanjay said.

--Shawn