tableau-desktop

Tableau: How can I combine calculated fields from 2 blended data sources in a text table


I have a worksheet on Tableau desktop that has 1 data source already set up in a text table. I added a 2nd source and blended it on Day. I want to combine fields vertically; e.g. I want to filter both by 'game' and display 'coinIn'.

Both sources have a calculated field called Game with different logic because the data sources have different game names. Both fields use logic like `IF [gameId] = 'mlb' THEN 'Baseball'. The first source uses [gameId], which is a calculated field. The 2nd source uses [Game Id] straight from the source. Both sources are BQ views.

How can I combine both Game fields so that they are both used as a filter and in Rows?

I've tried Created a calculated field that combines logic from both data sources' Game fields. It requires wrapping fields with ATTR to use 2 data sources. When I drag them to filters it applies an AGG wrapper and games are missing. The calculated field is forced to be a 'measure' and I can't convert it to a 'dimension'.

I don't really want to use a parameter because there are many game names.


Solution

  • I think the best way to handle this in general cases is to create a union of the 2 data sources rather than a blend. In my case, I continued to get errors for every field I tried after doing union. Eventually, I wrote a very simple custom query that did UNION ALL with the 2 BQ view datasources.