2 Replies Latest reply on Oct 5, 2018 10:32 AM by Tram Le-Nguyen

# How to identify null/multiple values in ATTR()

Hi,

For some table calculations, i have to use the attr() function. When I view the data it comes up as:

A
null
null
null
null
1
2
3

I want to make a table calculation similar to:

IF ISNULL(ATTR(A))

THEN "Null"

ELSE A/2

END

However, ISNULL(ATTR(A)) is never evaluated as true. I found out that the null values aren't actually empty values, but multiple values.

For my data set, this conditional expression works:

IF ATTR(A) > 0

THEN "Null"

ELSE A/2

END

I'm wondering if there is a direct way to identify if ATTR(A) has multiple values, in the case where i'm not able to use ATTR(A) > 0.

Thanks!

• ###### 1. Re: How to identify null/multiple values in an Attribute

There are a lot of unknowns in your post.  Can you upload a sample workbook that shows what you have?

You don't need to upload your entire workbook.  Pare it down to give enough data to show how you use [A].  Maybe a few other dimensions, and a bogus measure or two.

Make sure the data has some of the multiple-value examples for [A].

• ###### 2. Re: How to identify null/multiple values in an Attribute

I was able to find the answer myself through What ATTR() Does and Testing Whether ATTR() Returns * (Multiple Values)

Basically, I created a calculation called "Has Multiple A Values" like this:

1=

IF ISNULL(MIN([A]))

THEN    Null    //if each value is null, then null

ELSEIF MIN([A]) != MAX([A])

THEN    1       //multiple values found (ie: 2, 4, 5)

ELSEIF COUNT([A]) != SUM([Number of Records])

THEN    1       //multiple values, including null found (ie: 2, null, null)

ELSE    0       //single value found

END

And then I use that calculation in my table calculation

IF [Has Multiple A Values]

THEN NULL

ELSE [A]/2

END