• Just add another CASE statement where you check if the expression is NULL with IS NULL. If it is, use the expression m / tt. You might want to put this in an outer query for better readability.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP