
Data
I have 2 tables:
- Table 1 with columns `Dim 1`, `Dim 2`, `Value 1`
- Table 2 with columns `Dim 1`, `Dim 2`, `Value 2`
The 2 tables are connected with a relationship on `Dim 1 (Table 1) = Dim 1 (Table 2)` and `Dim 2 (Table 1) = Dim 2 (Table 2)`
Table 1 has keys `d1.1` and `d1.2` in `Dim 1` and table 2 only has values for `d1.2`.
Issue
I created a calculated field `Dim 1 (Table 1 & 2)` which is the coalesce of `Dim 1` from both tables:
IFNULL([Dim 1 (Table 1)], [Dim 1 (Table 2)])
When I calculate the `SUM` of `Value 1` on window `Dim 1 (Table 1)`, I get a value that is not NULL for `d1.1` and when I calculate the `SUM` of `Value 1` on window `Dim 1 (Table 1 & 2)`, I get a value that is NULL for `d1.1`. The 2 fields `Dim 1 (Table 1)` and `Dim 1 (Table 1 & 2)` are strictly equal.
Note: When omitting dimension `Dim 2` from both tables and operating a relationship on `Dim 1` only, the result is the other way around: both values are present for the first key but missing for the second:
Is this a bug from Tableau ?
How can I create a window function on a COALESCE of 2 columns from 2 different tables?
In practice, I actually don't use this key in my window calculation but in a filter on the same sheet, I need this filter to be shared between multiple sheets which display data from either tables. The problem, although more complex, is equivalent to the one listed above
If you take a look at the documentation of relationiship in Tableau you can see that only the relation conditions are applied when including the elements corresponding to the view, that's why I have tried the same thing you have done but using a Full outher Join, not relationship and it has given the result you expect.
Once a response addresses your problem, please click "Select as Best" so future users can quickly find the answer
Sincerely Pahola!
Attached you will find the workbook with the given solution