6 thoughts on “Creating a Table Report with Dynamic Columns

    1. I mention another technique that works with stored procedures here: https://sqlserverbiblog.wordpress.com/2010/03/11/dynamically-adding-and-removing-columns-to-a-query-and-report-2/
      You can use one procedure that returns all possible columns to create the dataset, and then use an expression in the dataset to switch it with a procedure that returns a subset of those columns. You can hide unused columns in a table by using the IsMissing property of the dataset field.

  1. Prawin

    Thanks for pointing out the omission. The column visibility expression would look something like this:
    =Fields!Product.IsMissing.
    I’ll post an update with this correction and a sample report as soon as I get a chance.

  2. Hi,
    I am a bit confused here..

    “Use the expression builder to create an expression that hides the column if that column is missing from the dataset result set:

    =Parameters!pQuery.Value

    Based on the above statement… one should use “=Parameters!pQuery.Value” as an expression..but i am getting an error “The Hidden expression used in tablix “tablix1” returned a datatype that is not valid…which actually makes as it just need True/False…but the value of the parameter would be query!

    Kindly let me know where I am doing wrong.

    Thanks,
    Prawin

Leave a Reply

Discover more from Paul Turley's SQL Server BI Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading