Paradox
Paradox

Reputation: 4566

Tableau Calculated Field Combining and Renaming Two Data Sources

I currently have the following calculation in Tableau:

IF CONTAINS(ATTR([Unix].[Environment]), 'PROD') THEN 'PROD'
ELSEIF CONTAINS(ATTR([Unix].[Environment]), 'QA') THEN 'QA'
ELSEIF CONTAINS(ATTR([Unix].[Environment]), 'STAGING') THEN 'STAGING'
ELSEIF CONTAINS(ATTR([Unix].[Environment]), 'UAT') THEN 'UAT'
ELSEIF CONTAINS(ATTR([Unix].[Environment]), 'INFRA') THEN 'INFRA'
ELSEIF CONTAINS(ATTR([Unix].[Environment]), 'DEV') THEN 'DEV'
ELSEIF CONTAINS(ATTR([Unix].[Environment]), 'DRP') THEN 'DRP'
ELSEIF CONTAINS(ATTR([Unix].[Environment]), NULL) THEN 'OTHERS'
ELSE 'OTHERS'
END

I have another data source called Windows that has the same field as Environment, except it is called ServerEnvironment. The intention of this calculated field is to be used to combine the Environment and ServerEnvironment fields to be used for columns. However, I do not know how to check for values in both Unix and Windows. I tried the following, to no avail:

IF CONTAINS(ATTR([Unix].[Environment]), 'PROD') 
OR CONTAINS(ATTR([Windows].[ServerEnvironment]), 'PROD')
THEN 'Prod'
.
.
.

How would I be able to combine checks in both Unix and Windows? The end goal is for example, Unix has a Value "PROD" and Windows has the value "PROD", so using the calculated field, this creates a column "Prod", and similarly for the other values.

Upvotes: 1

Views: 835

Answers (1)

Bernardo
Bernardo

Reputation: 3348

The only way to combine both data sources in your example is to either join them in the data source connection window or do data blending when connected to each separately. Either way, they must have some key field that you could join the two on.

Or you could also UNION the data outside of Tableau then connected to that single source. Without more information, I cannot recommend anything more specific.

Upvotes: 1

Related Questions