1 Reply Latest reply on Nov 23, 2016 9:02 AM by Joshua Milligan

# Set not listing all Customers

I've created below a Dimension called "Region" which references various created Sets. Each Set includes a list of customers.  When a customer falls into two Sets (eg. "East" and "Fed"), it will not include the customer if it were included in a previous line.   In the example below, the customer will appear in the "East" Set output but would not appear in the "Fed" output despite the customer being defined in both Sets.  If I flip the order below whereby Fed was the second line and East the third, it would appear in the Fed but not in East.  What should be the embedded logic in the calculated Dimension field to pull all customers in each of the sets below regardless of whether a customer is in another set?

Thanks!

Elias

Dimension named "Region"

If [Central] = true then "Central"

Elseif [East] = true then "East"

Elseif [Fed] = true then "Fed"

Elseif [West] = true then "West"

Elseif [South] = true then "South"

END

• ###### 1. Re: Set not listing all Customers

Elias,

What you describe is expected behavior.  A row-level calculation can only result in one value per row -- so you couldn't have "East" and "South" on one row.  (You could have a value of "East,South" - but you'd have to have an ELSEIF for that case).  Getting a specific answer for your question, as stated, is going to be difficult, because it's not obvious what your ultimate goal is.

• If you wanted to determine how many sets an individual customer belonged to, maybe a calculation like this:

IF [Central] THEN 1 ELSE 0 END    +     IF [South] THEN 1 ELSE 0 END    +     IF [East] THEN 1 ELSE 0 END  ....

• If you wanted to determine specific matches like which customers belonged to East and South,then

IF [East] AND [South] THEN "East and South Customer" ...

• If you wanted to have comma delimited list of regions (e.g. "East, South, Central"  or "East, South", etc...):

MID(

IF [East] THEN ", East" ELSE "" END +

IF [South] THEN ", South" ELSE "" END +

... , 2)

• If what you want is to have a view that shows a list of regions and tells you the number of customers in each (where customers can be double counted),

then realize that you cannot use a dimension for this.  A dimension slices the data.  And something belongs to one slice or another -- not multiple slices at the same time.  Instead, create a measure for each region:

[# East Customers]

IF [East] THEN 1 ELSE 0 END

[# South Customers]

IF [South] THEN 1 ELSE 0 END

... and so on -- a new calculated measure for each set...  then use Tableau's Measure Names / Measure Values feature to show them all in a single view.

Hope that helps!

Joshua