• drew.allen - Tuesday, January 2, 2018 1:25 PM

    Yes.  Use GROUPING SETS.  If you want a more complete answer, post sample data and expected results as outlined in the first link in my signature.

    This would be much easier in a report tool such as SSRS.  Have you considered that?

    Drew

    It will be on a SSRS server in the end, but how the program works is when they export to excel, it uses the stored procedure to gather the data.

    I looked up the Grouping sets and it appears you are correct, Never knew about them. Thanks. I will see if I can get it to work.