Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6044795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:03:08+00:00 2026-05-23T07:03:08+00:00

I have an SSRS grid report with a header row that SUM() s select

  • 0

I have an SSRS grid report with a header row that SUM()s select child rows.

In the SQL query, one Shift table inner joins to many Parts tables, meaning an Hours field on the Shift table is duplicated per part. I use the “Hide duplicates” SSRS feature on the Hours cell to fix this visually. The issue is that although the duplicates are hidden, the SUM() function (on the report, not the query) still includes them in its summation of hours.

So, I might have the following table and header. Duplicates of Hours (and Shift) are hidden, but still (undesirably) included in the summation.

SHIFT   HOURS     PART   ON HAND
=====   =======   ====   =======
        SUM:  8          SUM: 90
=====   =======   ====   =======
1st           3   X12Z        20
                  J23Z        10
2nd           1   Y36P        30
3rd           1   Q90F        30

I am simplifying the actual report, so displaying the data in a different way isn’t an option. Also, these are already in a group, so I’m not sure I can add another group. How do I get the SUM() function to return the sum of the hours shown?

EDIT:

I have posted a thorough answer to my own question, but if there is a better way to do this or my answer could be improved, please feel free to offer your critique. If there are still answers that significantly improve on my method, I will accept them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:03:09+00:00Added an answer on May 23, 2026 at 7:03 am

    Given how presumably common this format on a report is, I expected there to be more answers or at least a better way to do this. But, alas, my method follows:

    Rather than implement a cursor and loop through the table, run this update on the original results in a stored procedure. It clears the values of duplicated fields (i.e., shift, hours) where the current row’s part isn’t the part of the first row returned for this Shift. If there is an order by in the original query, include it in the nested select:

    update @tempResults
    set    shift = null, -- Shift is a duplicated field.
           hours = null, -- Hours is a duplicated field.
    where  part <> -- The part number identifies the duplicates.
           (
               select top 1 part
               from  #tempresults t
               where #tempresults.shift = t.shift -- Parts were grouped by shift.
               -- order by    the same fields from the original select statement.
           )
    

    Essentially, the formula is to:

    1. Nullify the fields in the “parent” table (the 1 in the 1:m relationship).
    2. Set the update‘s where using the “child” table’s identifying field.
    3. Set the select‘s where using the parent table’s identifying field.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a report in SSRS 2005 that's based on a query that's similar
I have an SQL Server Reporting Services (SSRS) report, that uses a view. That
I have an SSRS report that uses an Oracle datasource. I have a query;
I have a SSRS 2005 report that has a number of images in it.
I have created a one-time subscription in SSRS report manager 2008. However I keep
I have created a report in SSRS that contains 2 matrices (not tables/lists), each
I have a SQL 2008 developer edition with SSRS and the report manager is
Is it possible to have SSRS's Report Manager display a report name that is
I have a SSRS report which displays hundred of rows. I was wondering if
I have an SSRS report that contains several sub-reports. The user has the ability

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.