Hide column if all rows are empty

I have tablix in SSRS 2008, and I have a column that sometimes has data and sometimes not. I want to hide the column if NO rows have no data.

So this will hide column 2:

Column 1 Column 2 Column 3 Column 4 1 3 4 2 3 4 

This does NOT hide column 2:

 Column 1 Column 2 Column 3 Column 4 1 3 4 2 2 3 4 

Is there a way to do this in SSRS 2008?

Thanks!

+8
sql-server-2008 reporting-services ssrs-2008
source share
6 answers

I suspect you need to invent. For example, run a query to get the number of non-empty rows for a column. Then use the count result as part of the expression for the column visibility property. That is, if the number is greater than zero ... is displayed.

This can help

Reporting Services - Hide table column based on report parameter

+1
source share

A very old post, but I came up with a better solution for this using the SSAS cube. Since all aggregation has already happened in SSAS, you can simply check to see if the parent hierarchy level has a value.

This is done accordingly:

 =IsNothing(Fields!Field.Value) 

No summation or if statements are needed in SSRS. Since the function evaluates to true or false , and also because the expression evaluates whether the column should be hidden (i.e. True hides it), all that you need in the formula.

+5
source share

If you have fields that contain values, not numbers, then the following should work to hide columns that only have NULL values ​​for each row in the column.

Put this code in the expression in the Visbility column object for each column that you want to evaluate

 =IIF(Count(Fields!<NAMEofCOLUMN>.Value) = Cint(0), True, False) 
+3
source share

In design

Go to the column, right-click and select "Column Visibility"

Choose show or hide based on the expression and give the expression as:

 =iif(Fields!column_name.Value=Nothing,True,False) 
+1
source share

You can examine the column visibilty property for tablix based on the expression: If there is nothing, then the condition is just Nothing.

Follow the link:

SSRS 2008 Column Visibility Expression True; column not displayed

0
source share

Select all the columns in the Table and set the Visibility - Hidden as properties:

 =IIF(Fields!ColumnSample.Value = Nothing, True, False) 
0
source share

All Articles