Sangeeth878787 - Tuesday, February 28, 2017 2:26 AM
Martin has used ISNULL, as a SUM of NULLs or SUM of NO ROWS = NULL. You are using a COUNT, which means that COUNTof NULLs or COUNT of NO ROWS = 0.
Notice that both myself and Martin have moved the order of your tables in your FROM clause, your Fact is now not the base table. Have you used the SQL I provided above, I am confident that it will work. Please don't amend it like above (using the fact table in the WHERE clause), run it exactly as it is, only replacing the underlined part of cast(Count(i.somefield AS varchar(100))) with a valid column name in your fact table.
If it doesn't work, paste back what you ran again.and provide SAMPLE data. Please also remember to put SQL in code IFCode brackets, it is much easier to read 🙂
Thanks.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk