Dynamic Columns Based on Multi-Select Parameter

  • I've just been developing a few reports in SSRS and have an issue I need to work out. Not sure if I'm on the right path.

    What I would like to do is allow users to select a date group/groups from a parameter list and then have each parameter show as the column header in proper order.

    For example, the list would look something like "11/12", "12/13", "13/14", 2011, 2012, 2013, 2014, 2014Q1, 2014Q2. So a user would pick "12/13" and "13/14". The resulting report would look like.

    Item 12/13 13/14

    A 6 6

    B 25 24

    C 99 99

    Total xxxx xxxx

    They could pick 5 parameters so there would be 5 columns, or just one parameter and there would be just one column.

    The formula for the datafield for column 1 would read something like =Sum(iif(DateGroup=Parameter1.value,itemcount.value,0)) and the header expression would be parameter1.value.

    In my contemplation on this, there would be a "order" value assigned to each DateGroup parameter so they show in the right column order.

    Is this even possible? If so, would it be some kind of "loop" that would take the count of parameters to develop the columns? Or would I set up say 8 columns and then hide anything that isn't used based on the parameter count?

    I've done a lot of searching but, haven't come across anything yet that fits this idea. Thanks for your input.

  • could you post some sample data? Maybe a create table and insert scripts so we can see what you're doing? it looks like you can use a Matrix to get what you want, but it's hard to tell.

  • I'll get to work on that. I tried a Matrix, but that didn't work because the selected DateGroup column needs to show even if there is no data for it.

  • "but that didn't work because the selected DateGroup column needs to show even if there is no data for it."

    If you outer join the DateGroup columns to the other data, you will force those columns to appear in the dataset whether there are related records for them or not. Then you can summarize that in matrix

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply