Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I'm hoping to get some guidance from the group on where to go with this. I have 2 queries that run in sequence that read from my Fabric data warehouse. The queries are different and should yield different results but when they run, they actually return the same data.
Solved! Go to Solution.
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.
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!
Hi @mheggie,
Before concluding it an engine bug or caching issue, I would like to first think purely from a data/query perspective. If you are only looking at row counts as validation, it is possible that even if there are only 67 distinct liability keys, [GL Account Key] in rpt.vw_DimGLAccount may contain 2,365 rows matching these 67 keys (given, no DISTINCT is being applied in the outer query).
Another reason could be that [LiabilityGLAccountKey] and [ExpenseGLAccountKey] contain identical values, or one is a subset of other, over the filtered date range.
Could you first verify this, by looking at the actual result sets, rather than relying solely on row counts?
Thanks for the feedback. I have evaluated the results along with the counts. What I've shared in my post is accurate. I should get 2365 rows returned for one query and 67 for the other. LiabilityGLAccountKey and ExpenseGLAccountKey values are not identical and are not a subset of one another. Liabilities post to a different place in the GL than expenses.
If I change the "select *" in each query to a "select count(*)", the numbers returned are correct. When I then change the "count(*)" back to "*", it returns the same result for both.
Also ... the process with this logic has been running successfully in production since May 2025. It is only in the last few weeks that this has been a problem. I've tested this with other keys that reference the same dimension and can consistently re-create the issue.
When the second query runs, it notes that it is using cached results.
Hi @mheggie ,
Thank you for reaching out to Microsoft Community.
I recommend reporting the bug using the link below on the MS Fabric Forum.
Issues - Microsoft Fabric Community
Thanks & Regards,
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 4 | |
| 3 | |
| 3 |