I have a dataset which generates results in this.
Parent | NodeName | Value | ID |
---------------------------------------------
AAA | Name | blah1 | 1 |
AAA | val | 1 | 1 |
BBB | tag | tag2 | 2 |
BBB | Name | blah2 | 2 |
BBB | val | 2 | 2 |
AAA | tag | tag1 | 1 |
CCC | Name | blah3 | 3 |
CCC | tag | tag3 | 3 |
CCC | val | 3 | 3 |
AAA | Name | blah4 | 4 |
AAA | tag | tag4 | 4 |
AAA | val | 4 | 4 |
I would like to group this
AAA
-----------------------------------------
| Name | Val | Tag |
-----------------------------------------
| blah1 | 1 | tag1 |
| blah4 | 4 | tag4 |
BBB
-----------------------------------------
| Name | Val | Tag |
-----------------------------------------
| blah2 | 2 | tag2 |
CCC
-----------------------------------------
| Name | Val | Tag |
-----------------------------------------
| blah3 | 3 | tag3 |
I have tried some tricks from this link but still no luck. Thanks. http://agilebi.com/jjames/2010/09/10/how-to-pivot-data-in-ssrs/
I tried what @jimmy8ball suggested in comments. The design surface looked like
As I only have three groups AAA, BBB and CCC at the moment. I have created three different datasets with filters to only include one group eg, AAA. The result looks like this.
I am not sure if it is the best way of doing. Any suggestions welcome.
Yet another update based on @Jimmy8ball. I am unable to get it working still as per @Jimmy8ball response.
My dataset result looks like this
My design surface looks like this.
My result as per @jimmy8ball response looks like this, the second set of values for AAA are missing. Any suggestions?
One solution is to group by Parent, then ID for the Maxtix Rows, and NodeName for the columns (and Value for the values). It groups the data in the way you need, but the format isn't exactly the same as what you wanted.
If you want to have the column headers repeat for each Parent, one way is to use an outer List or Tablix for the Grouping.
to update the previous answer, follow the below setup, I have tweaked the matrix to display the NodeName as the split for each Parent, just as before, remove any auto counts or sums
using row number and partition by here helps maintain the grouping levels, here is the sql i have used
select parent+'-'+convert(varchar,ROW_NUMBER() over(partition by parent, nodename order by id)) as parent, nodename, value, id
from dbo.test1 t
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.