Question

Consider the following data source:

declare @Test table (EmpId int, ProdId int, Sold int)
insert @Test (EmpId, ProdId, Sold) values (1, 1, 1)
insert @Test (EmpId, ProdId, Sold) values (1, 2, 2)
insert @Test (EmpId, ProdId, Sold) values (1, 3, 3)
insert @Test (EmpId, ProdId, Sold) values (1, 4, 4)
insert @Test (EmpId, ProdId, Sold) values (2, 1, 5)
insert @Test (EmpId, ProdId, Sold) values (2, 2, 6)
insert @Test (EmpId, ProdId, Sold) values (2, 3, 7)
insert @Test (EmpId, ProdId, Sold) values (2, 4, 8)
select * from @Test

I create a Sql Server Reporting Services (SSRS) 2008 R2 report that contains a single Matrix configured like this:

|         | [ProdId]    |
| [EmpId] | [Sum(Sold)] |

Which, in preview mode, renders to the following (as expected):

|   | 1 | 2 | 3 | 4 |
| 1 | 1 | 2 | 3 | 4 |
| 2 | 5 | 6 | 7 | 8 |

But when I export it to CSV I get this:

| EmpId | ProdId | Sold |
| 1     | 1      | 1    |
| 1     | 2      | 2    |
| 1     | 3      | 3    |
| 1     | 4      | 4    |
| 2     | 1      | 5    |
| 2     | 2      | 6    |
| 2     | 3      | 7    |
| 2     | 4      | 8    |

In other words, when I export to CSV I lose the matrix layout and each row of data is rendered to a single row of CSV. Note that the report works as expected if I export to Excel, so this problem seems limited to CSV so far. I have tried restructuring the matrix as a table-within-a-table but that doesn't solve it either. Any suggestions?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top