• Hi Jeff,

    Thanks for commenting. At this point I don't, but I haven't put Dwain's code in production. One of my principles of the help I get on this forum is to never put a line of code in production I don't completely understand. I could envision such a thing going really bad at some point.

    (As a side note the only exception I've made to that rule is median-of-quartile calculation that Dwain helped me with a couple of days ago. I can follow everything he did but CROSS APPLY. I've read 6 articles and still don't quite get it! But I absolutely had to have a the median-of-quartile calculations to create an SSRS chart for a one-off presentation. Since I could hand verify the accuracy of the data from other reports I've written, I did a single run. But now that code is offline until I can play with CROSS APPLY enough to understand it. That's the only exception I remember.)

    Generally I always ask follow-up questions regarding how examples work on anything that is above my pay grade. There is a "how'd you do that" reply in probably 3 out of every 4 posts I start - and some I don't! However, since Dwain helped me so much on the recent post, I felt bad asking. So I've been working through the linked article, and on Monday I'll start working through his code in my test environment (I had to back off the project yesterday and today to pull data for a last minute request for our board of trustee meeting).

    Would you mind explaining it to me? I understand the temp table and the insertion of the SUM'd data from the subquery in the FROM clause. But I get lost with some of the details in subquery, and after he declares the two variables its all downhill 🙂 The code looks great, I just get lost at that point. Either way, I'll continue working through the article and reading adding explanations. But having my test example explained would probably speed up my understanding!