• Hi ChrisM@Work,

    Thank you for your suggestions. I have now managed to find the line in my query which is returning NULL values.

    (T0.TotalSales - T0.StockValue) / NULLIF(T0.StockValue, 0) AS 'Gross Profit %'

    I have identified that the NULLIF(T0.StockValue, 0) section of the above line is responsible, even more specifically the T0.StockValue column itself seems to be the source of my challenge. If I modify the above line by replacing T0.StockValue with 0 then I get nothing but NULLs in my result set.

    e.g.: NULLIF(0, 0) gives nothing but NULLs

    On the other hand if I substitute the number 1 in place of T0.StockValue I get NO NULLs.

    e.g.: NULLIF(1, 0) gives a complete set of values, with NO NULLs.

    I have used a similar line of SQL in another query and it did not return any NULLs, the line is as follows -

    (sum(T0.LineTotal - T0.StockValue) / nullif(sum(T0.StockValue), 0)) * 100 as 'Profit %'

    Above I am summing a collection of values so I suppose there is less likely to be a NULL?

    At any rate if you have any more suggestions please let me know.

    Kind Regards,

    David