Reputation: 2575
I have two data sources in Tableau, 1 and 2 with variables say V1 and V2, respectively. I need to perform the row-level calculations using data from both the sources, say X=V1+V2.
When I do that, tableau asks to aggregate the data from secondary data source like sum or average and throws the error "all fields must be aggregate or constant when using table calculation functions or fields from multiple data sources"
How can I do the row level calculation using data from both the sources?
Upvotes: 1
Views: 7390
Reputation: 1330
The concept of "row" is meaningless across two unrelated data sources. A row in one source is unrelated to a row in the other source so there is no meaningful "row" on which calculations can be done.
But, if there is a definable relationship between the two sources, then you can proceed. For a relationship to exist both tables need to contain a common column (say both tables have different information about employees: you could join them together using the employee ID which should be present in both).
In Tableau you can either blend the two tables together (when both tables are open, go to Data:Edit Relationships menu) or you can join them together at the point of importing them (this is when you use the Data:New Data Source menu).
Once Tableau understands the relationship between the tables, you can do various calculations using parts from both tables.
Upvotes: 1
Reputation: 11921
Row level calculations are by definition within the same data source. You can either use a cross database join to make a new data source drawn from the original two sources, or use data blending to combine aggregate results.
Upvotes: 3