SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Dynamic Grouping in SSRS Reports


Dynamic Grouping in SSRS Reports

Author
Message
AndyOwl
AndyOwl
SSC Veteran
SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)

Group: General Forum Members
Points: 212 Visits: 182
Comments posted to this topic are about the item Dynamic Grouping in SSRS Reports

Andy is a director of Wise Owl, a UK company providing training courses (and occasional consultancy) in SQL, Reporting Services, Integration Services and Analysis Services, as well as in many other Microsoft software applications. You can see more about Wise Owl's SQL Server training courses here.
aa.nichol
aa.nichol
SSC Rookie
SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)

Group: General Forum Members
Points: 32 Visits: 53
Hi Andy

Although I am not new to SSRS I still find things a bit puzzling sometimes, mainly the terminology. I felt your tutorial was very good, however, would it be possible to download the example file so I could follow the tutorial more closely.

Regards

AA
SQLPhil
SQLPhil
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2264 Visits: 740
Excellent article Andy! Very clearly laid out and makes a fairly advanced piece of report development appear straightforward.
jcrawf02
jcrawf02
SSCertifiable
SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)

Group: General Forum Members
Points: 7220 Visits: 19324
Interesting idea, have you seen a lot of use for this? Seems to me if the users wished to dig into the data and summarize on their own, they might be better served by exporting to Excel and using pivot tables? I suppose they might run into some data limitations given a large data set, but that would allow for multiple levels of grouping, etc that the report design does not.

---------------------------------------------------------
How best to post your question
How to post performance problems
Tally Table:What it is and how it replaces a loop

"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
twgage
twgage
SSC Rookie
SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)

Group: General Forum Members
Points: 25 Visits: 9
I see this as a way of bringing the pivot tables of Excel to an SSRS report - to a degree, anyway.
I'll bet that a future version of SSRS will include a much easier way to accomplish this.

Creating something like this with report parts, generic enough to use as a template, would be the next logical step.
mtassin
mtassin
SSCrazy Eights
SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)SSCrazy Eights (9.9K reputation)

Group: General Forum Members
Points: 9892 Visits: 72521
jcrawf02 (10/11/2012)
Interesting idea, have you seen a lot of use for this? Seems to me if the users wished to dig into the data and summarize on their own, they might be better served by exporting to Excel and using pivot tables? I suppose they might run into some data limitations given a large data set, but that would allow for multiple levels of grouping, etc that the report design does not.


I've written a few dynamic grouping reports in my past (mostly in crystal reports) and they've always been popular with management types who can't be bothered to fiddle around in Excel.

This is a pretty good example of how to do this and well done.



--Mark Tassin
MCITP - SQL Server DBA
Proud member of the Anti-RBAR alliance.
For help with Performance click this link
For tips on how to post your problems
whenriksen
whenriksen
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1847 Visits: 652
I've used a slightly different approach for dynamic grouping. Instead of setting the grouping expression to a parameter, I define calculated fields in the dataset named simply Group#.

I have used this for up to three exclusive levels of grouping. By exclusive I mean that the grouping options are filtered so that the item selected to group by in level 1 is not available in the parameter list for group level 2.

I have also found this to be very maintanable for others as the logic is contained exclusively in the calculated field and grouping within the report is handled just like using a normal field. It is also very easy for others to understand what they are looking at when the cell values are set to use fields named Group1, Group2, Group3 rather then seeing <expr> in all of the cells. Just like in the article, I hide the headers/footers for a level when they select "No Group".

Wes
(A solid design is always preferable to a creative workaround)
mahen83
mahen83
SSC Rookie
SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)

Group: General Forum Members
Points: 28 Visits: 23
Hi Andy,

Excellent Article. Personally I never thought of GROUPING in this way in SSRS report.

Keep it up.. !! your atricle really helped..
mtillman-921105
mtillman-921105
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2168 Visits: 3852
This is terrific, thank you. I'll have to try that.

______________________________________________________________________
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking
mtillman-921105
mtillman-921105
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2168 Visits: 3852
Unfortunately, "Grouping" has two meanings. At first, I was thinking of "Grouping" as in a T-SQL "GROUP BY" clause. But what this really does is create a conditional stepped report, to use SSRS' terminology - or maybe it could be called a parameterized stepped report.

In this case, you're not really changing the number of rows, but reordering them with headers. This is still terrific, but I just thought I'd clarify that.

______________________________________________________________________
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search