3 Replies Latest reply on Jan 28, 2020 7:47 AM by Corey Malone-Smolla

# Join Calculation Else and IF

Hi! I worked with a Tableau Service Corps member to join my data. We realized my two county columns were not matching because some were written as York County and the other just York as . My service corps member wrote this join calculation below and it worked. I've realized however that a few other endings are getting in the way of having this work out including:

Parish

Borough

Municipality

Census Area

What would be the way to modify this to do the exact same thing my service corps member did but to incorporate the ones above?

If CONTAINS([County], 'County') then

TRIM(

LEFT([County],FIND([County],'County') -1))

ELSE

TRIM(

LEFT([County],FIND([County],'Municipio') -1))

END

• ###### 1. Re: Join Calculation Else and IF

Hi Corey,

A sample workbook would help understand your problem better.

Regards,

Rohit

• ###### 2. Re: Join Calculation Else and IF

There's really no need to do the IF.  I would do the original County problem as :

TRIM(

REPLACE([County], 'County','')

)

So you can now do this if you have more values :

TRIM(

REPLACE(

REPLACE(

REPLACE(

REPLACE(

REPLACE([County], 'County','')

,'Parish','')

,'Borough','')

,'Municipality','')

,'Census Area','')

)

Basically, for every phrase that you want to replace, put a REPLACE after the TRIM (as a new line is easy for logic and maintenance) and the replace text at the end (before the last bracket close)

1 of 1 people found this helpful
• ###### 3. Re: Join Calculation Else and IF

Yes, brilliant, perfect! Thank you so much, how easy!