560 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Make an SSRS matrix dynamic, like a pivot table
Part two of a two-part series of blogs
Create a matrix whose row, column and data fields are all selectable from dropdown lists.
The steps to follow to create our matrix are:
Here's the sort of effect we're trying to achieve:
The user can choose the row, column and data fields from dropdowns.
For each of these 3 parameters you should follow more or less the same steps. I'll show how to create the column field dropdown (the other two will be created in the same way). First create a parameter:
Right-click on Parameters and choose to add a new one.
Give your new parameter a sensible name and prompt:
We'll call this parameter ColumnField, and specify that it's of type Text.
Now make this into a dropdown parameter by adding available values (one for each possible field value that a user can choose):
Here the columns can be certificates, countries, directors or studios.
When you've done this for all 3 parameters, you should have something like this:
The 3 parameters which will be chosen at the top of your report.
You should also set default values for all 3 parameters, so that a sensible matrix appears when you first run the report.
Now that you have your 3 dropdown parameters, it's time to create the matrix. To do this, add a basic matrix:
Create a basic matrix - we'll add the row and column groupings in a second.
What you now have to do is to specify the row and column groups, and the data field. To do the row group, for example, first change the group's properties:
Right-click on the RowGroup and change its properties.
Set the grouping field to be an expression:
Add a group expression, and set this to be the field chosen by the user in the drop list.
You can set the colum grouping expression to be something similar:
The column grouping expression uses the same concept.
For the data expression, right-click on the data text box and choose to set an expression for it:
Right-click on the Data textbox and set its expression.
We'll show the average of the data field chosen in the parameter drop list:
Show the average of a field whose name is chosen by the user at run-time.
You now need to add labels and a title for your report:
|As it is now||The final report|
For box number 1 (the matrix title), you want it do display something like:
The title will refer to the parameter choices made by the user.
A typical title will thus look something like this:
The title if you show average budget by certificate and director.
For box numbers 2 and 3, you could use expressions like this:
Notice that we keep repeating the same trick - using the Fields collection to refer to a field whose name is equal to the value of the relevant dropdown parameter.
If you're fired up after reading this article, you could try creating a report with dynamic grouping (ie the user chooses which field they want to group by).
|Parts of this blog|
|When:||24 Oct 17 at 14:22|
What if I want to have multi select parameters to do this. Do you have an example to set the expression for row or column groups for multi select parameters. This would effectively be like grouping with AND condition on multiple fields.
|When:||24 Oct 17 at 17:15|
An interesting question! The problem is that as far as I know you can't group by than one field at once. I think it would be very complicated. You'd have to somehow include more than one grouping level, then hide the grouping levels you didn't need if you only chose one value in the multivalue parameter.
The only other possibility that I can see is to create some composite field containing all of the things you might want to group by (so if you can choose to group by one or more of Director, Studio and Certificate, create every possible combination of these fields as separate composite keys). Not only would this be ridiculously complicated, but I don't think it would give the right results.
Any ideas, anyone?
|When:||03 Jul 21 at 16:58|
I struggle with the same requirements now, I need to give user possibility to choose which attributes will dynamically find in the row group.. is there any solution for that?
|When:||06 Jul 21 at 08:58|
There's no simple solution as far as I know. You'll have to choose the least worst option from:
Writing a long IIf or Switch function to work out which fields to group on;
Creating multiple hidden tables and showing one of them depending on the user's choice;
Creating a separate page for each combination of groups and using navigation tools to allow the user to reach each page.
25 Aytoun Street