Forum Discussion
Fabric Warehouse Incorrect Query Results
- 6 months ago
yeah, best to raise a ticket with product support - use the menu above Support > Product Support to log the new support case. Please make it clear in the ticket that removing the variable StartingDate resolves it; and the issue seems to be happening quite recently.
If my workaround helped please mark it as a solution, so that others in this situation can take advantage of this workaround!
Hello mheggie
It is a very strange behavious indeed! Can you try using a WITH clause instead of a IN clause and let me know if you see any difference in the behaviour? Here's one of your query with a WITH clause.
-- Derive the starting date: first day of the current year minus 10 years
DECLARE @StartingDate DATE = DATEADD(YEAR, -10, DATETRUNC(year, GETDATE()));
WITH PayrollGL AS (
SELECT DISTINCT F.ExpenseGLAccountKey
FROM gold.FactPayrollHistory AS F
JOIN gold.DimDate AS D
ON F.PeriodEndDateKey = D.DateKey
WHERE D.CalendarDate >= @StartingDate
)
SELECT a.*
FROM rpt.vw_DimGLAccount AS a
JOIN PayrollGL AS p
ON a.[GL Account Key] = p.ExpenseGLAccountKey;
Thanks for your suggestion.
I tested with your query for both expense and liability and they both return what is expected. I had already worked around this by replacing @StartingDate in the where clause with the expression I was using to calculate it and it works.
- deborshi_nag6 months agoSuper User
yeah, best to raise a ticket with product support - use the menu above Support > Product Support to log the new support case. Please make it clear in the ticket that removing the variable StartingDate resolves it; and the issue seems to be happening quite recently.
If my workaround helped please mark it as a solution, so that others in this situation can take advantage of this workaround!