KatInterview

Tableau Blend vs Join: Targets Against Sales Walkthrough

SQL & DataModel answer
HardModel answerSQL & Datatableaudata-blendingjoins

Last updated

Work out exact join and blend results on two small tables, then explain how filter order, fan-out and granularity change the numbers and when blending is the better choice.

A sales analyst is comparing actual sales to targets in Tableau. There are two small tables.

Orders (the primary source): OrderID, State, Category, Sales

OrderIDStateCategorySales
O1CAFurniture100
O2CAOffice Supplies200
O3NYTechnology150
O4TXFurniture300
O5CATechnology50

Targets (the secondary source): State, Category, MonthlyTarget

RowStateCategoryMonthlyTarget
ACAFurniture500
BCATechnology400
CNYFurniture250
DFLTechnology600

Answer each part with exact numbers and a short reason.

  1. Joins. Physically join the tables on State and Category. Which rows survive an inner join, and what are SUM(Sales) and SUM(MonthlyTarget) per State/Category? Repeat for a left join from Orders to Targets.
  2. Blend. Blend Targets into Orders, with Orders as primary and State and Category on Rows. Walk through how Tableau builds the view. How do the unmatched combinations (NY–Technology, TX–Furniture, FL–Technology) appear, and are the missing values null or zero?
  3. Filters. Show how the results change, and why, given Tableau's order of operations, for each of these:
    • (a) a dimension filter Category = 'Furniture' taken from Orders
    • (b) the same filter taken from Targets
    • (c) a context filter State = 'CA' on Orders
    • (d) a measure filter SUM(Sales) > 150 on the view
    • (e) a data source filter on Targets keeping Category IN ('Furniture','Technology')
  4. Pitfalls. Describe two situations where a blend and a join give different aggregates (level of detail, many-to-many matches, duplicate keys). Give a concrete example from this data.
  5. Judgment. When would you choose a blend over a join? Cover cross-database needs, required granularity, how the linking field behaves, performance and caching, and limits on calculations (FIXED LODs, table calcs) that involve the secondary source.

Hints

Hint 1

A join combines rows first and aggregates afterwards. A blend aggregates each source separately at the level of the linking fields, then attaches the secondary result to the primary marks.

Hint 2

In a blend only the primary source creates marks, so secondary-only combinations such as FL–Technology can never appear. Also ask what a filter on a secondary field does to rows where that field is null.

Hint 3

For the pitfalls, count how many target rows match each order when the join key is coarser than the data (join on State only), and ask which link fields are actually active when only State is in the view.