4

I need to hide column if all rows in column is empty (blank).

In this case col3 should be hidden, because no values in column.

col1 col2 col3
 v1   v4
 v2
 v3   

I'm using following expression on columns Hidden property:

=IIF(Fields!Test5.Value = "",TRUE,FALSE)

This expression working, but It hidding each blank(empty) field, even all column isn't empty. It should hide column only when there is no values at all.

Pedram
  • 6,256
  • 10
  • 65
  • 87

2 Answers2

8

You can use:

=IIF(Max(Field, Dataset)= "",TRUE,FALSE)

If the maximum value is empty it means that there is nothing, and make your hide expression on column.

sdrzymala
  • 387
  • 1
  • 10
  • Please reference directly to dataset, ie: =Max(Fields!InvoiceID.Value, "SalesInvoiceDS") We are referencing to the "whole" dataset values, not current tablix context – sdrzymala Mar 02 '15 at 09:35
  • @sdrzymala this is great. Thanks a lot! I just want to mention that if you want to hide the column use the Visibility field and not the Hidden one.This way, when the column is empty, no gap will be present. So, in case of a tablix, right click on the column, choose Column Visibility and write down the above expression below "Show or hide based on an expression". – Olaru Mircea Jun 02 '16 at 09:04
4

in case of an SSRS report, right click on the column and click Textbox Properties, choose Column Visibility and write down the below expression on "Show or hide based on an expression"

You can use below if the column value is Null:

=IsNothing(Fields!Column.Value) 
niks
  • 125
  • 1
  • 9
  • This does not answer the question of hiding if *all* values in the column are empty. At best, if it works at all, this will silently get the *first* value (implied `First()`) and wrongly hide based on that. – underscore_d May 28 '19 at 08:45