andrewt 30066 (2/3/2014)
I'm looking to create a report with a list of shops grouped by company area, the report would look something like.
Shop1 || Shop 2 || Shop3
Shop 4 || Shop 5 || Shop 6
Shop 7 || Shop 8 || Shop 9
Is this possible to do in SSRS?
I have done something similar before, it should be possible if you can add some stuff to your query.
I did mine by creating a CTE for the bulk of the query, in which there was a field (modified for your case) like:
-- some other columns from your query
(Row_number() over (order by ShopAreaNum ASC, ShopNum ASC)) / 3.0) AS RowGroup
--changing the divisor changes the number of columns
And then later in the final Select from the CTE I do another calc on that column, using that field:
ROW_NUMBER() OVER (
PARTITION BY YourCTE.RowGroup ORDER BY ShopAreaNum ASC, ShopNum ASC
) AS ColumnGroup
ORDER BY RowGroup ASC, ColumnGroup ASC
In your actual report you would then embed a Matrix, grouping the rows and columns by the RowGroup and ColumnGroup respectively, with your totals in the Details.
Then if you embed *that* matrix in a rectangle which is itself grouped by the ShopAreaNum, you should have what you need.
If not, hopefully that will put you down a path towards success.