Issue: joining with a saved question (v.0.35.4, MSSQL)

Hello,

I’m trying to join “previous results” output with a saved question built based on several tables (dimensional model). That doesn’t work and I get an error: “The multi-part identifier “Question 6467”.“Location” could not be bound.” When looking at the SQL statement Metabase generates, I see that dimension tables (location and product in this case) are not included and table aliases are wrong. For example:

[…]
LEFT JOIN (
SELECT “Question 6467”.“Item_Code” AS “Item_Code”
,sum(“dbo”.“Fact_Stock”.“Quantity”) AS “Quantity”
FROM “dbo”.“Fact_Stock”
WHERE “Question 6467”.“Location” = ‘Berlin’
GROUP BY “Question 6467”.“Item_Code”
) “Question 6467” ON “source”.“Item_Code” = “Question 6467”.“Item_Code”

Is this a bug? Is there a workaround? Thanks.

Hi @Alex
Without understanding the full context, I’m pretty sure it’s the same as one of these issues:
https://github.com/metabase/metabase/issues/12507
https://github.com/metabase/metabase/issues/12762