0

I have two fields, one named "StatusCode" and one name "Projects"

Status         projects

Active         Project A

Not started    Project B

Active         Project C

How do I display the data in SSRS in such way in a table?

Active       Not Started

Project A    Project B

Project C

So what I ended up doing was to create multiple lists (tablix) with filters in them.

(Since only tablix could apply filters in there)

Thanks for the answers!

Felixable
  • 21
  • 5

2 Answers2

0

Method 1: SSRS

  1. Update the SQL

    SELECT Project, Status , Row_Number() OVER (Partition BY Status ORDER BY Project) RN FROM ProjStatTbl

  2. Create a matrix

  3. Column Grouping on Status

  4. Row Grouping on newly created Rank RN

    Matrix with Groupings

  5. Delete left most column only not the associated group.

    Delete Columns

  6. In the main cell put the Project. Here is final matrix.

    Final Matrix

  7. Voila! you are done

    Output

Method 2: SQL
You can transpose the columns in SQL using pivot transformation or using Aggregates.

Here is the SQL Statement

SELECT  
  MAX(CASE WHEN Status = 'Active' THEN Project ELSE NULL END) AS Active
, MAX(CASE WHEN Status = 'Not Started' THEN Project ELSE NULL END) AS NotStarted
FROM
  (SELECT Project, Status
      , Row_Number() OVER (Partition BY Status ORDER BY Project) RN
   FROM ProjStatTbl) Y
GROUP BY RN

Once data is transposed now you can use table to represent your data.

If you have more Status then you would need to update your SQL statement or use Dynamic pivot to generate Columns. Here is a link which shows different methods of transposing your SQL data.

Simple way to transpose columns and rows in Sql?

Community
  • 1
  • 1
Anup Agrawal
  • 6,551
  • 1
  • 26
  • 32
  • 1
    Method 1 works fine, but it will create an empty value in each row...be something like Active | Not Started A | | B | C – Felixable Aug 19 '14 at 20:43
  • @user3755064 Check the updated answer. Updated the SQL query and used the new column for row grouping. – Anup Agrawal Aug 20 '14 at 05:43
0

So what I ended up doing was to create multiple lists (tablix) with filters in them.

(Since only tablix could apply filters in there)

Thanks for the answers!

Felixable
  • 21
  • 5