From a query, I get these results:
Machine 1, Product A, 1 pal
Machine 1, Product B, 2 pal
Machine 1, Product C, 3 pal
Machine 2, Product D, 2 pal
Machine 2, Product E, 2 pal
Machine 3, Product F, 1 pal
I would like to create a report that looks like this:
Machine 1 | Machine 2 | Machine 3
Product A | Product D | Product F
1 pal | 2 pal | 1 pal
Product B | Product E |
2 pal | 2 pal
Product C
3 pal
I know above formatting sucks but it gives an idea. I guess this is the same problem as in New group in New column but with another technology. Is anyone able to help? Would be very much appreciated, thanks!
Here is one possible way of achieving this using SSRS
Matrixreport item in conjunction with SQL ServerROW_NUMBERfunction. Following example shows how this can be done. The example usesSSRS 2005withSQL Server 2008 R2database.Step-by-step process:
SSRS 2005Created a table named
dbo.GroupColumnsrepresenting the data that you provided as shown in screenshot #1. Create scripts of the table is provided under SQL Scripts section.Created a query shown in screenshot #2, which will be used to create the SSRS dataset. Query is provided under SSRS dataset query section. Screenshot #2 shows the query output in Management Studio. The query uses
ROW_NUMBER()function to assign sequential numbers within a givenMachinesorted byMachineandProduct.On the SSRS Report, place a
Matrixreport item. Refer screenshot #3.Drag and drop
RowRank,MachineandProductvalues from the data set onto the Matrix as shown in screenshot #4.Right-click on the cell containing Product value and select Add Row as shown in screenshot #5. A new second column will be added along with a new row.
Drag and drop the
Unitscolumn from data set onto the Matrix as shown in screenshot #6.Set the Width property on the second matrix column to
0 (zero)because we don’t want to show that column. Even though it is set to zero, the value will change to0.03125 in. Screenshot #7 shows the Matrix report item after applying some formatting and coloring.Hope that helps.
SQL Scripts:
SSRS dataset query:
Screenshot #1:
Screenshot #2:
Screenshot #3:
Screenshot #4:
Screenshot #5:
Screenshot #6:
Screenshot #7:
Screenshot #8: