locked
Pivot Table with Dynamic Columns and Headers RRS feed

  • Question

  • Hello,

    I'm trying to pivot a table of data where the column headers will be dynamic.  While I know how to pivot the table to get what I want how will I be able to pick up the table column header from the Pivot to display in the report?

    For example:

    Unpivoted data is Employee Code, Branch Code, Problem Code, # of Problems.

    There is many records for a given Employee and Branch that I want to pivot so the Column headers are the Problem Codes and the data below is the SUM(num_problems) for that Problem.

    So the data may look like this for Tech Bob, Branch NY.

    • Problem = LEAK, Num_problem = 5
    • Problem = DAMAGE, Num_problem = 2
    • Problem = OTHER, Num_problem = 3

    Which problem codes may appear is unknown but selecting the DISTINCT(problem) across all techs gives me the column headings to use.

    So if I pivot this data, I get this Row:

    • Tech = Bob, Branch = NY, DAMAGE = 2, LEAK = 5, OTHER = 3

    So first can SSRS handle having dynamic columns?  Only Tech and Branch are known and the remaining columns are dynamic based on how many Problems they worked on.

    Second, how can I set the column heading in my Tablix to be the Problem Code?


    Sherry

    Thursday, December 11, 2014 11:45 PM

Answers

All replies